Guide API
Skip to main content

Clock

Trait Clock 

Source
pub trait Clock {
    // Required method
    fn now_ms(&self) -> u64;
}
Expand description

Monotonic millisecond clock.

Two implementations are provided: SystemClock for production and ManualClock for deterministic tests. Only SystemClock may call Instant::now() — all other code receives u64 ms values from the injected clock.

§Turbo Vision heritage

Faithful to TTimePoint (a uint64_t ms tick count) and THardwareInfo::getTickCountMs. The injected clock makes time deterministic in tests (deviation D11).

Required Methods§

Source

fn now_ms(&self) -> u64

Monotonic milliseconds since some fixed epoch.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§