From 88e2aba93c98c1913baa8ae96f6e736df7076627 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 1 Mar 2021 13:36:36 +1000 Subject: [PATCH] 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. --- rslib/src/timestamp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rslib/src/timestamp.rs b/rslib/src/timestamp.rs index a037abae8..f8aadd1df 100644 --- a/rslib/src/timestamp.rs +++ b/rslib/src/timestamp.rs @@ -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); }