core::time
On this page
Duration / Instant.
The wall and boot clocks are std::time. Every span between two
readings is an exact signed Duration: an earlier minus a later one
is negative, never an error or zero.
Structs
DurationSource
pub struct DurationA span of time: i64 nanoseconds (about +/-292 years).
nnanoseconds.nmicroseconds; overflow panics wherei64 *does, else saturates.nmilliseconds; overflow panics wherei64 *does, else saturates.nseconds; overflow panics wherei64 *does, else saturates.nminutes; overflow panics wherei64 *does, else saturates.nhours; overflow panics wherei64 *does, else saturates.ndays of 24 hours; overflow panics wherei64 *does, else saturates.No time.
The longest duration.
sseconds, truncated to whole nanoseconds. A non-finite or out-of-range result panics; with overflow checks off it saturates (NaN to zero).Whole nanoseconds.
Whole microseconds, truncated toward zero.
Whole milliseconds, truncated toward zero.
Whole seconds, truncated toward zero.
Seconds as an
f64, fraction included.The part below one second (of the magnitude for a negative span).
subsec_nsin whole microseconds.subsec_nsin whole milliseconds.self + rhs;noneon overflow.self - rhs;noneon overflow.self * factor;noneon overflow.self / divisor;nonewhendivisoris 0 or on overflow.self + rhs, clamped to thei64nanosecond range.self - rhs, clamped to thei64nanosecond range.self * factor, clamped to thei64nanosecond range.
InstantSource
pub struct InstantA point on the monotonic clock; only meaningful within one process.
The current monotonic time.
The time passed since
self.self - earlier, negative whenearlieris later.self + d;noneon overflow.self - d;noneon overflow.