pub enum Clock {
System,
Logical(LogicalClock),
}Expand description
The run’s time source. All executor timestamps — event recorded_at,
measured latencies, checkpoint created_at — are read through it.
Clone is cheap (a shared handle), so the same clock can serve the
executor, every spawned node task, and an attached journal.
Variants§
System
Wall-clock UTC (chrono::Utc::now). The default; identical to
pre-R0.5 behavior.
Logical(LogicalClock)
A deterministic logical clock. Starts at start_ms (epoch millis)
and advances by tick_ms on every read. Two runs with the same
parameters observe the same timestamp sequence, which is what makes
recorded evidence reproducible.
The tick-on-read semantics mean timestamps reflect how many clock
reads happened, not how much wall time passed — that is the point:
the journal’s logical order is defined by seq, and timestamps
become a deterministic attribute rather than a second, unreliable
clock.
Implementations§
Source§impl Clock
impl Clock
Sourcepub fn logical(start_ms: u64, tick_ms: u64) -> Self
pub fn logical(start_ms: u64, tick_ms: u64) -> Self
A logical clock starting at start_ms (epoch millis), advancing
tick_ms per read.
Sourcepub fn now(&self) -> DateTime<Utc>
pub fn now(&self) -> DateTime<Utc>
The current time. Under Clock::Logical, every call advances the
clock by its tick.
Sourcepub fn now_ms(&self) -> u64
pub fn now_ms(&self) -> u64
The current logical clock value in milliseconds (the value stamped
into crate::record::CheckpointHeader::logical_clock). Reads
through the same seam as Clock::now, so logical clocks tick.