Module clock

Module clock 

Source
Expand description

Wall-clock source, injected so consumers read “now” deterministically in tests.

Production wires SystemClock (real Utc::now()); tests construct a deterministic fake (FixedClock / SteppingClock) and pass it to the unit under test.

Sibling to crate::sync::hlc::Hlc’s wall_clock: that one returns u64 millis for hybrid-logical-clock math, this one returns DateTime<Utc> for created_at / updated_at / expiry comparisons. Both are injected wall sources rooted at the same composition point; neither subsumes the other.

Structs§

FixedClock
Every now() returns the same instant.
SteppingClock
Advances a fixed delta per now() call: the first call returns start, the next start + step, and so on. For tests that assert ordering.
SystemClock
Production clock: real wall time.

Traits§

Clock
Wall-clock source. Returns a full DateTime<Utc>; callers derive .timestamp() / .to_rfc3339() as they need.

Type Aliases§

ClockRef
Shared handle to a clock. Held by Clone types (Database, LibraryManager) so they clone the handle, not the implementation.