From 7e308676ff3f9c655b5b0b59bbee0e5df891e9ee Mon Sep 17 00:00:00 2001 From: Khang Date: Mon, 4 Jan 2021 00:08:17 -0500 Subject: [PATCH] address comments --- src/lib.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 23da9d0..0d8b568 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -141,13 +141,14 @@ impl Game { let state_ref = unsafe { &mut *self.state.get() }; if state_ref.timing_mode != TimingMode::FrameSynchronized { - // Even with the non-monotonic Instant mitigation at the start of the event loop, - // there's still a theoretical chance of it not working. - // This check here should trigger if that happens and makes sure there's no panic from an underflow. let mut elapsed = self.start_time.elapsed().as_nanos(); - if elapsed < self.last_tick { - warn!("Elapsed time was less than last tick! elapsed: {}, last tick: {}", elapsed, self.last_tick); - elapsed = self.last_tick; + #[cfg(target_os = "windows")] + { + // Even with the non-monotonic Instant mitigation at the start of the event loop, there's still a chance of it not working. + // This check here should trigger if that happens and makes sure there's no panic from an underflow. + if elapsed < self.last_tick { + elapsed = self.last_tick; + } } let n1 = (elapsed - self.last_tick) as f64; let n2 = (self.next_tick - self.last_tick) as f64;