Multiply duration, not milliseconds

This commit is contained in:
Greg Fitzgerald 2018-05-14 13:58:42 -06:00
parent a2c05b112e
commit 27984e469a
1 changed files with 3 additions and 2 deletions

View File

@ -28,7 +28,7 @@ pub struct Recorder {
receiver: Receiver<Signal>,
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;
}
}