don't panick on time subtraction failure (#141)
On some machines, the system clock can be faulty and start_time maybe actually be after the end time. This causes a panic, instead gracefully just put a None time in `self.last_runtime`
This commit is contained in:
parent
1b755036ad
commit
ad9a2faaea
@ -90,7 +90,7 @@ impl<EM, I, S, Z> HasExecHooks<EM, I, S, Z> for TimeObserver {
|
|||||||
_mgr: &mut EM,
|
_mgr: &mut EM,
|
||||||
_input: &I,
|
_input: &I,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
self.last_runtime = Some(current_time() - self.start_time);
|
self.last_runtime = current_time().checked_sub(self.start_time);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user