Handle monotonic clock going backwards during runtime 2022-08-time-goes-backwards
authorMatt Corallo <git@bluematt.me>
Fri, 2 Sep 2022 21:57:32 +0000 (21:57 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 2 Sep 2022 21:57:32 +0000 (21:57 +0000)
commit82474d356403d6b91c6b8ad1937e942f53f809e8
treebcd0fba4788bbc88487501328956ee885b1fd3f0
parent36bffb56e8b738ca5ccb7056594e956fddc02573
Handle monotonic clock going backwards during runtime

We've had some users complain that `duration_since` is panic'ing
for them. This is possible if the machine being run on is buggy and
the "monotonic clock" goes backwards, which sadly some ancient
systems can do.

Rust addressed this issue in 1.60 by forcing
`Instant::duration_since` to not panic if the machine is buggy
(and time goes backwards), but for users on older rust versions we
do the same by hand here.
lightning/src/util/time.rs