RapidTime

This crate defines two types: DateTime and
Duration, which are useful to model times in
combinatorial optimization problems.
- The smallest unit is a second.
- In addtion to actual times,
DateTime::EarliestandDateTime::Latestrepresents plus and minus infinity, respectively. - Besides finite durations,
Duration::Infinityrepresents an infinite duration. Durationscan be added to or subtracted fromDateTimes.Durationscan be added to or subtracted from each other and implementSum.DateTimescan be subtracted from each other to produce aDuration.DurationsandDateTimesare total ordered. (They implementOrd.)- No negative durations are allowed.
- Both types are
CopyandClone.
Usage
- Basic Usage
use ;
let tour_start = new;
let tour_length = new;
let tour_end = new;
assert_eq!;
assert_eq!;
assert_eq!;
// Note that 2024 is a leap year.
# use ;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
- More
Duration
# use ;
assert_eq!;
assert_eq!;
assert_eq!;
// Duration::from_seconds(10) - Duration::from_seconds(20); // panics
- More
DateTime
# use ;
assert_eq!;
// DateTime::new("2024-01-01T08:00") - DateTime::new("2024-01-01T09:00"); // panics