From c52d4b5ae43c202569c8801c312c2b56954ff8a0 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 25 Oct 2026 23:00:56 +0100 Subject: add clock module The Clock module is the system clock that every unix timestamp new goes through. It comes with an offset that only tests can set. --- src/remake/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/remake/mod.rs') diff --git a/src/remake/mod.rs b/src/remake/mod.rs index 9085475..3980d38 100644 --- a/src/remake/mod.rs +++ b/src/remake/mod.rs @@ -58,6 +58,15 @@ pub(crate) trait Host: Clone + Send + Sync + 'static { /// This node's in-memory remake state. fn remake(&self) -> &RemakeState; + /// This node's wall clock (`clock`): deadlines, votes and decisions are stamped and + /// judged with it. Shared, so closures run under the document lock can read it. + fn clock(&self) -> Arc; + + /// Now, in Unix milliseconds, by [`clock`](Self::clock). + fn now_millis(&self) -> u64 { + self.clock().now_millis() + } + /// This node's ID (its peers know it by this). fn node_id(&self) -> String; -- cgit v1.3.1