Skip to main content

Clock

Trait Clock 

Source
pub trait Clock:
    Send
    + Sync
    + 'static {
    // Required methods
    fn now(&self) -> Instant;
    fn unix_ms(&self) -> i64;
}
Expand description

Abstraction over time sources, enabling deterministic testing.

Required Methods§

Source

fn now(&self) -> Instant

Returns a monotonic instant for freshness / elapsed-time checks.

Source

fn unix_ms(&self) -> i64

Returns wall-clock time as Unix milliseconds (for incarnation generation).

Implementors§