pub trait Clock: Send + Sync {
// Required method
fn now(&self) -> Timestamp;
// Provided method
fn now_datetime(&self) -> OffsetDateTime { ... }
}Expand description
A source of the current time.
Implementors are Send + Sync so a clock can be shared as Arc<dyn Clock>
across tasks.
Required Methods§
Provided Methods§
Sourcefn now_datetime(&self) -> OffsetDateTime
fn now_datetime(&self) -> OffsetDateTime
The current instant as a time::OffsetDateTime (always UTC).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".