From 27984e469a25ab1eadab65631945662949aad105 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Mon, 14 May 2018 13:58:42 -0600 Subject: [PATCH] Multiply duration, not milliseconds --- src/recorder.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/recorder.rs b/src/recorder.rs index 2ec50aea28..208d62b6ed 100644 --- a/src/recorder.rs +++ b/src/recorder.rs @@ -28,7 +28,7 @@ pub struct Recorder { receiver: Receiver, last_hash: Hash, num_hashes: u64, - num_ticks: u64, + num_ticks: u32, } impl Recorder { @@ -62,8 +62,9 @@ impl Recorder { ) -> Result<(), ExitReason> { loop { if let Some(ms) = ms_per_tick { - if epoch.elapsed() > Duration::from_millis((self.num_ticks + 1) * ms) { + if epoch.elapsed() > Duration::from_millis(ms) * (self.num_ticks + 1) { self.record_entry(vec![])?; + // TODO: don't let this overflow u32 self.num_ticks += 1; } }