mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
Should check Duration subtraction (#1860)
This commit is contained in:
@@ -174,7 +174,7 @@ struct NextPoVPruning(Duration);
|
|||||||
impl NextPoVPruning {
|
impl NextPoVPruning {
|
||||||
// After which duration from `now` this should fire.
|
// After which duration from `now` this should fire.
|
||||||
fn should_fire_in(&self) -> Result<Duration, Error> {
|
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 {
|
impl NextChunkPruning {
|
||||||
// After which amount of seconds into the future from `now` this should fire.
|
// After which amount of seconds into the future from `now` this should fire.
|
||||||
fn should_fire_in(&self) -> Result<Duration, Error> {
|
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