I am in the process of rewriting a log-searching program in Rust, which it takes arguments like --on 'Apr 1 13:00' --around '6 hours'. This crate worked a treat for --on, but I really would like access to the underlying duration argument, so I added it!
I thought about returning a Duration, but that's fraught (because you have to deal with daylight savings, and leap seconds, and so on), so instead it just returns an Interval, so that the user can decide what to do with it. (In our existing log searcher, for example, a month is always 30 days and a day is always 24 hours, which is fine for our needs.)
I am in the process of rewriting a log-searching program in Rust, which it takes arguments like
--on 'Apr 1 13:00' --around '6 hours'
. This crate worked a treat for--on
, but I really would like access to the underlying duration argument, so I added it!I thought about returning a
Duration
, but that's fraught (because you have to deal with daylight savings, and leap seconds, and so on), so instead it just returns anInterval
, so that the user can decide what to do with it. (In our existing log searcher, for example, a month is always 30 days and a day is always 24 hours, which is fine for our needs.)