Skip to main content

Module clock

Module clock 

Source
Expand description

Clock helpers for tests.

These are thin conveniences around klauthed_core::time::FixedClock, the controllable test clock. Construct one pinned to a known instant, then pin or advance it explicitly so time-dependent logic is fully deterministic.

Clock and Timestamp are re-exported here so tests can pull everything time-related from one place.

Structs§

Duration
A span of time with nanosecond precision.
FixedClock
A controllable clock for tests: pin time to a fixed instant and advance it explicitly. Shareable through &self, so it works behind Arc<dyn Clock>.
Timestamp
A point in time (UTC), the canonical instant type.

Traits§

Clock
A source of the current time.

Functions§

epoch_clock
A FixedClock pinned to the Unix epoch (0 ms).
fixed_clock
A FixedClock pinned to unix_millis milliseconds since the Unix epoch.