pub trait Clock {
// Required method
fn now(&mut self) -> Now;
}Expand description
A source of monotonic (and optionally wall-clock) time.
Implementations live in adapters — never in protocol or orchestrator crates,
which receive Now from their caller instead.
now() takes &mut self so implementations can cache or correct state,
such as latching a monotonic floor over a clock that can step backwards.
§Contract
monotonic_msnever decreases across successive calls, and saturates atNow::MAX_MONOTONIC_MSrather than reaching the reservedu64::MAX.unix_secondsisNonewhenever no usable wall-clock reading is available — either the platform has no wall clock, or its clock reads before the Unix epoch. An implementation must not fabricate one from monotonic time.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".