pub trait WallClock: Send + Sync {
// Required method
fn now(&self) -> SystemTime;
}Expand description
Provides the current civil time as a SystemTime.
Unlike monotonic time, wall time may move backward after a system clock adjustment and must not be used to measure elapsed durations.
Discarding a sampled wall time is rejected when unused_must_use is denied:
ⓘ
#![deny(unused_must_use)]
use qubit_clock::{StdWallClock, WallClock};
StdWallClock::new().now();Required Methods§
Sourcefn now(&self) -> SystemTime
fn now(&self) -> SystemTime
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> WallClock for &T
impl<T> WallClock for &T
Source§fn now(&self) -> SystemTime
fn now(&self) -> SystemTime
Delegates to the borrowed wall clock object.
§Returns
The current wall time returned by the borrowed clock.
Source§impl<T> WallClock for Arc<T>
impl<T> WallClock for Arc<T>
Source§fn now(&self) -> SystemTime
fn now(&self) -> SystemTime
Delegates to the shared wall clock object.
§Returns
The current wall time returned by the wrapped clock.
Source§impl<T> WallClock for Box<T>
impl<T> WallClock for Box<T>
Source§fn now(&self) -> SystemTime
fn now(&self) -> SystemTime
Delegates to the boxed wall clock object.
§Returns
The current wall time returned by the wrapped clock.