runic
Stupid string to duration converter
General usage
Two mods are available: using timeout and/or using exact time.
Order of things does not matter, feel free to mix everything however you want.
Quick example for the timeout:
Quick example for the exact time:
In the latter, it will calculate duration between your local "now" and specified exact time.
To Message, Or not to Message
The following timers are exactly the same, all three of them will return the same duration back, the only difference is that the last one has some text for the user.
Learn by Example
The simplest timer you can launch
This will simply return 30 seconds!
You can combine multiple durations
These durations might be of any length as long as it makes sense to you!
This will return an hour and 2 minutes!
Exact times can be used
Duration between current time and specified value will be calculated and added:
consider it is 8 am now (08:00)
This will return an hour and 15 minutes!
You can use - in front of the duration
It will tell the timer that you want to move the target one hour towards your current time:
This will return 30 minutes!
It works great when using with exact times
consider it is 4pm now (16:00)
This will return an hour!
Timeout
Timer is a total of all specified timeouts combined. You can specify timeouts using keywords for hours, minutes and seconds.
Note that the space between the timeout and keyword is optional.
Hours
hourshourhrshrh
E.g.
Minutes
minutesminuteminsminm
E.g.
Seconds
secondssecondsecssecs
E.g.
Floating numbers
You can use . in your timeouts. For example, when you need to quickly specify
2 hours 30 minutes, but you don't want to write it down, you can do this:
Or, possibly the shortest way to describe 30 minutes is:
Exact Time
The word at is a keyword. It marks the beginning of the exact time
expression and is used to specify some time of interest explicitly.
Under the hood it calculates the duration between the local now
and the target time:
Just like with timeouts, the space between the time and "am"/"pm" is optional.
Minutes part is optional and is going to be set to 0 by default, so
the following timers are equal:
Using other timezones to compare
The word utc (case insensitive) is a keyword. It's used at
the end of exact time expressions to point that the time I
am targeting is actually in a different timezone than me.
Giving the following example - 10 am UTC, programm will figure out whatever it means for your current local time and calcualte an appropriate timeout for the action.
You have four variants how to specify utc keyword:
Just utc
Using just utc is an alias for utc+0 (or utc-0 for that matter).
The following examples are all the same:
Short variant
Short variant is when you only want to specify a target hour.
Long variants
Specify an hour, following by the optional colon, following by the minutes.
Note that you have to use two digits for the hours and two digits for the minutes always in the long variants.
Examples with the colon:
Examples without the colon (just 4 digits):
Where a day starts and ends?
In case specified time is in the past relative to the current 24h day, it carries out to the next day, for example:
Consider it is October 1st, 11:30pm (23:30)
There already was point in time when 2am of October 1st occurred, so it carries out to the next day, October the 2nd, effectively setting your timer for 2 hours 30 minutes.
The same happens with more distant points in time, like this:
consider it is October 1st, 4:15pm (16:15)