Crate systemd_duration

Source
Expand description

systemd-duration is a library that parses systemd-style durations.

It can parse durations into the following formats:

  • [time::Duration][::time::Duration] (with the with-time feature)
  • [chrono::TimeDelta][::chrono::TimeDelta] (with the with-chrono feature)
  • std::time::Duration

It uses the nom library to parse durations.

§Example

let td = systemd_duration::stdtime::parse("1d3s").expect("Could not parse duration");
assert_eq!(td, std::time::Duration::from_secs(86403));

Modules§

duration
error
parser
stdtime