summaryrefslogtreecommitdiffstats
path: root/src/swarm/sync.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-10-25 23:00:56 +0100
committertv <tv@krebsco.de>2026-10-25 23:00:56 +0100
commit539f84c217aec506c894379643e97c20624dc72c (patch)
tree4cc71b5c3282f589144a02d9a4bf236ccc9cec57 /src/swarm/sync.rs
parentea0b45fd82d421c97cd3a52c75979adae97678b0 (diff)
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.
Diffstat (limited to 'src/swarm/sync.rs')
-rw-r--r--src/swarm/sync.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/swarm/sync.rs b/src/swarm/sync.rs
index d4503bb..a05e346 100644
--- a/src/swarm/sync.rs
+++ b/src/swarm/sync.rs
@@ -330,6 +330,7 @@ pub(crate) async fn handle_sync(
let epoch = envelope.epoch;
let message = envelope.message;
let peer = peer.to_owned();
+ let clock = Arc::clone(&state.clock);
// Some((caught_up, heads changed)) when applied, None when the message belongs
// to another epoch.
@@ -366,7 +367,7 @@ pub(crate) async fn handle_sync(
stats.heads_seen(heads_after.len());
let changed = heads_after != heads_before;
if changed && measure_propagation {
- let now_ms = crate::state::unix_millis() as i64;
+ let now_ms = clock.now_millis() as i64;
// Time 0: not stamped (snapshots, older nodes).
let delays: Vec<i64> = replica
.doc