Module time

1.25.0 ยท Source
Expand description

Temporal quantification.

ยงExamples:

There are multiple ways to create a new Duration:

let five_seconds = Duration::from_secs(5);
assert_eq!(five_seconds, Duration::from_millis(5_000));
assert_eq!(five_seconds, Duration::from_micros(5_000_000));
assert_eq!(five_seconds, Duration::from_nanos(5_000_000_000));

let ten_seconds = Duration::from_secs(10);
let seven_nanos = Duration::from_nanos(7);
let total = ten_seconds + seven_nanos;
assert_eq!(total, Duration::new(10, 7));

Macrosยง

sum_durations ๐Ÿ”’
try_from_secs ๐Ÿ”’

Structsยง

Duration
A Duration type to represent a span of time, typically used for system timeouts.
TryFromFloatSecsError
An error which can be returned when converting a floating-point value of seconds into a Duration.

Enumsยง

TryFromFloatSecsErrorKind ๐Ÿ”’

Constantsยง

MICROS_PER_SEC ๐Ÿ”’
MILLIS_PER_SEC ๐Ÿ”’
NANOS_PER_MICRO ๐Ÿ”’
NANOS_PER_MILLI ๐Ÿ”’
NANOS_PER_SEC ๐Ÿ”’
DAYS_PER_WEEK ๐Ÿ”’ Experimental
HOURS_PER_DAY ๐Ÿ”’ Experimental
MINS_PER_HOUR ๐Ÿ”’ Experimental
SECS_PER_MINUTE ๐Ÿ”’ Experimental