Expand description
timecalc is a simple library to calculate duration expressions into a total duration.
§Duration expressions
Duration expressions can be specified as intervals and durations.
§Intervals
Intervals are specified as start-end
, e.g. 9-12:30
.
§Durations
Durations are specified as +duration
or -duration
, e.g. 1h
or -30m
.
Valid duration units are:
w
for weeksd
for daysh
for hoursm
for minutes
§Example
use timecalc::{formatter::duration_to_str, parser::parse_expressions};
let args = vec!["1h", "2h", "-30m"];
let total_duration = parse_expressions(&args).unwrap();
let output = duration_to_str(total_duration);
assert_eq!(output, "2h 30m");