From 6fb72ce21b03d7a766c838033eac0d600e3591c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 27 Nov 2026 07:39:15 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20test:=20playout=20clock=20resyncs?= =?UTF-8?q?=20when=20sharer=20timestamps=20restart?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/client/src/share/session.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/client/src/share/session.rs b/crates/client/src/share/session.rs index 7fdb10b..dcd6130 100644 --- a/crates/client/src/share/session.rs +++ b/crates/client/src/share/session.rs @@ -1137,6 +1137,19 @@ fn flush( mod tests { use super::*; + #[test] + fn clock_follows_sharer_restart() { + let clock = Clock { + started: Instant::now(), + offset: AtomicI64::new(i64::MAX), + delay: AtomicI64::new(INITIAL_DELAY_MS), + }; + clock.observe(116_000); + assert!((clock.now() - clock.origin(116_000)).abs() < 50); + clock.observe(0); + assert!((clock.now() - clock.origin(0)).abs() < 50); + } + #[test] fn every_codec_round_trips() { let capabilities = encode::capabilities();