A simple date-time calculator.
Features:
- Datetime in ISO format at input like
2024-08-25T16:48:25+00:00. - Timestamps like
1724606867.000. nowkeyword. For sake of simplicity, the "now" time is rounded to seconds.- Arithmetic on time deltas, like
now + 1d - 2m - 1s. - Brackets:
now - (1d + 2m). - Arithmetic on times and sub-expressions:
now + (2000-01-01T01:00:00Z - 2000-01-01T00:00:00Z). - Built-in functions:
full_dayandfull_hour, likefull_day(now).
Usage:
% ./tscalc -- 'full_day(now) + (2000-01-01T00:00:00Z - 1234567890.000) + 1d - 2h - 3s'
2015-07-12T22:28:27+00:00It is a rewrite of a similar toy tool in Go.
make releaseFind the binary in:
./target/release/tscalcGenerate a sequence of times separated by minute in custom format:
seq 1440 | while read d; do tscalc -f %F-%H-%M -- "2024-06-01T00:00:00Z + ${d}m"; done - Dates like
2024-01-01are not recognised. 1msGives parse error