Skip to main content

Crate harn_clock

Crate harn_clock 

Source
Expand description

Unified Clock trait for the Harn runtime.

Production code that needs the current time, monotonic measurement, or a cancellable sleep takes an Arc<dyn Clock> and reads through it. Real deployments wire RealClock; tests substitute PausedClock to drive virtual time deterministically; recording layers wrap any inner clock with RecordedClock to capture every observation for replay.

See docs/src/dev/testing.md for usage patterns.

Structs§

ClockEventLog
In-memory append-only log of clock observations.
PausedClock
Fully-virtual clock for tests.
RealClock
Production clock. Reads OffsetDateTime::now_utc() and tokio::time::sleep. Honors tokio::time::pause() for sleep-driven scheduling but now_utc always returns true wall time.
RecordedClock
Wraps an inner Clock and records every observation to a ClockEventLog.

Enums§

ClockEvent
Single observation captured by RecordedClock.

Traits§

Clock
Unified clock abstraction.

Functions§

now_wall_ms
Convenience: current wall-clock millis since UNIX_EPOCH.