fix inconsistent test handling on Windows

Bazel sets TZ to UTC when running tests, so the tests are reproducible.
But it seems like the Rust time crate was not honoring it, and using
the configured timezone instead. "Fix" by forcing UTC when testing, as
we already special-case a test run.
This commit is contained in:
Damien Elmes 2021-03-01 13:36:36 +10:00
parent 8f0c8b6f8a
commit 88e2aba93c

View File

@ -66,7 +66,7 @@ fn elapsed() -> time::Duration {
let mut elap = time::SystemTime::now()
.duration_since(time::SystemTime::UNIX_EPOCH)
.unwrap();
let now = Local::now();
let now = Utc::now();
if now.hour() >= 2 && now.hour() < 4 {
elap -= time::Duration::from_secs(60 * 60 * 2);
}