Multiply duration, not milliseconds
This commit is contained in:
@ -28,7 +28,7 @@ pub struct Recorder {
|
|||||||
receiver: Receiver<Signal>,
|
receiver: Receiver<Signal>,
|
||||||
last_hash: Hash,
|
last_hash: Hash,
|
||||||
num_hashes: u64,
|
num_hashes: u64,
|
||||||
num_ticks: u64,
|
num_ticks: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Recorder {
|
impl Recorder {
|
||||||
@ -62,8 +62,9 @@ impl Recorder {
|
|||||||
) -> Result<(), ExitReason> {
|
) -> Result<(), ExitReason> {
|
||||||
loop {
|
loop {
|
||||||
if let Some(ms) = ms_per_tick {
|
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![])?;
|
self.record_entry(vec![])?;
|
||||||
|
// TODO: don't let this overflow u32
|
||||||
self.num_ticks += 1;
|
self.num_ticks += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user