Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    // Required method
    fn now(&self) -> DateTime<Utc>;
}
Expand description

Abstract clock source. Implementors must produce a DateTime<Utc> on every call to now(). Implementors that track elapsed time (Monotonic, Fixed) maintain their own internal anchor and must not require external synchronisation.

Required Methods§

Source

fn now(&self) -> DateTime<Utc>

Current instant as a UTC datetime. The timezone-resolution layer (crate::time::tz) is responsible for converting to the rendered zone.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§