From 4855ff63536430b1cd26734a0eeeaf0c25df553e Mon Sep 17 00:00:00 2001 From: tv Date: Sat, 31 Oct 2026 06:51:17 +0100 Subject: calculate peer clock drift --- src/transport/identity.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/transport/identity.rs') diff --git a/src/transport/identity.rs b/src/transport/identity.rs index eb7bb93..a748505 100644 --- a/src/transport/identity.rs +++ b/src/transport/identity.rs @@ -603,6 +603,15 @@ impl Transport for IdentityTransport { self.shared.paths.rtt(&address) } + /// The narrowest of its proven paths'. + fn clock_offset(&self, peer: &str) -> Option { + self.shared + .proven_at(peer, false) + .iter() + .filter_map(|address| self.shared.paths.clock_offset(address)) + .min_by_key(|offset| offset.within_ms) + } + /// The identity layer's, and each transport's. fn stats(&self) -> TransportStats { let mut stats = self.shared.paths.stats(); -- cgit v1.3.1