pub trait Clock: Send + Sync {
// Required method
fn now(&self) -> SystemTime;
}Expand description
A source of wall-clock time required by application behavior.
Implementations may be production clocks, deterministic test clocks, or adapters around an application-owned time source. The contract does not prescribe ownership, synchronization, or a runtime.
Clocks are Send + Sync, so a resolved &dyn Clock can be shared with
worker threads, spawned tasks and scheduled jobs.
Required Methods§
Sourcefn now(&self) -> SystemTime
fn now(&self) -> SystemTime
Returns the current wall-clock time.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".