mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-10-24 04:35:04 +00:00
Should check Duration subtraction (#1860)
This commit is contained in:
1 parent
cb30705eea
commit
a416667a2b
1 file changed
+2
-2
@@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user