Skip to main content

WallClock

Trait WallClock 

Source
pub trait WallClock: Send + Sync {
    // Required method
    fn now(&self) -> Result<WallTimestamp>;

    // Provided method
    fn now_ms(&self) -> Result<u64> { ... }
}
Expand description

Object-safe source of host wall-clock observations.

Implementations may move backward between observations. Code that needs a correctness clock must instead use a logical tick, revision, or monotonic deadline.

Required Methods§

Source

fn now(&self) -> Result<WallTimestamp>

Observes the current host wall-clock timestamp.

Provided Methods§

Source

fn now_ms(&self) -> Result<u64>

Observes the current host wall clock as Unix milliseconds.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§