Unverified Commit a751843f authored by Fedor Sakharov's avatar Fedor Sakharov Committed by GitHub
Browse files

Should check Duration subtraction (#1860)

parent c7ba5ce5
Pipeline #112172 passed with stages
in 21 minutes and 1 second
......@@ -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())
}
}
......
Supports Markdown
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