guardmgr: fix a unit test panic.

Apparently on OSX you are not allowed to construct an Instant that is a
long time before the time when the test is running.

Also, fix the length of a year in this test.
This commit is contained in:
Nick Mathewson 2022-04-11 14:13:17 -04:00
parent 9f7a80b5f2
commit 61080dcaec
1 changed files with 5 additions and 1 deletions

View File

@ -313,7 +313,7 @@ mod test {
assert!(est.is_none());
// Same with fewer than min_observations.
let year = Duration::from_secs(365 * 60 * 60);
let year = Duration::from_secs(365 * 24 * 60 * 60);
let obs = vec![
SkewObservation {
skew: ClockSkew::Fast(year),
@ -325,6 +325,10 @@ mod test {
assert!(est.is_none());
// Same with many observations all of which are obsolete.
//
// (advance the clock: not all Instant implementations let you go back a long time
// before startup.)
let now = now + year;
let obs = vec![
SkewObservation {
skew: ClockSkew::Fast(year),