Skip to content
Snippets Groups Projects
Commit a416667a authored by Fedor Sakharov's avatar Fedor Sakharov Committed by GitHub
Browse files

Should check Duration subtraction (#1860)

parent cb30705e
No related merge requests found
......@@ -174,7 +174,7 @@ struct NextPoVPruning(Duration);
impl NextPoVPruning {
// After which duration from `now` this should fire.
fn should_fire_in(&self) -> Result<Duration, Error> {
Ok(self.0 - SystemTime::now().duration_since(UNIX_EPOCH)?)
Ok(self.0.checked_sub(SystemTime::now().duration_since(UNIX_EPOCH)?).unwrap_or_default())
}
}
......@@ -192,7 +192,7 @@ struct NextChunkPruning(Duration);
impl NextChunkPruning {
// After which amount of seconds into the future from `now` this should fire.
fn should_fire_in(&self) -> Result<Duration, Error> {
Ok(self.0 - SystemTime::now().duration_since(UNIX_EPOCH)?)
Ok(self.0.checked_sub(SystemTime::now().duration_since(UNIX_EPOCH)?).unwrap_or_default())
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment