Skip to main content

Module time

Module time 

Source
Expand description

Logical-clock abstraction shared across the substrate.

Time-based behaviour in atomr (stream throttling, replay gating, rate limiting) historically reached for tokio::time directly, which couples correctness to the wall clock. That is fatal for deterministic replay and point-in-time backtests, where consumers must not observe data “ahead” of a simulation watermark regardless of async latency.

This module introduces a pluggable Clock so production code runs on SystemClock while replay / backtest harnesses drive a ManualClock they advance explicitly. It is the foundation for the clock-gated stream source (FR-2), the token-bucket rate limiter (FR-3), and record-and-replay determinism (FR-13).

Structs§

LogicalTime
Monotonic logical time, measured in nanoseconds since an arbitrary epoch.
ManualClock
An explicitly-advanced logical clock for deterministic replay and backtests.
SystemClock
Wall-clock Clock backed by SystemTime.

Traits§

Clock
A source of LogicalTime.