Skip to main content

Clock

Trait Clock 

Source
pub trait Clock: Send + Sync {
    // Required method
    fn now_millis(&self) -> i64;
}
Expand description

A source of the current time.

The succession rules and the lease clock take an instant as a parameter, so they need no clock at all. This trait is the seam for the code around them that reads a real clock. A test supplies TestClock and drives time by hand, with no sleep.

Required Methods§

Source

fn now_millis(&self) -> i64

The current time, in milliseconds since the Unix epoch.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§