Change `INSTANT.epoch()` to now - 1 day.

Some services (like focus), use `DInstant::EPOCH` to initialize timestamps and then compare it to `INSTANT.now`. This caused a sporadic bug where highlight was enabled for the first focus event in a test run.
This commit is contained in:
Samuel Guerra 2024-04-04 18:11:45 -03:00
parent 93bfa2face
commit 2d071a1f96
1 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@ impl INSTANT {
DInstant(self.epoch().elapsed())
}
/// Instant of first usage of the [`INSTANT`] service in the process.
/// Instant of first usage of the [`INSTANT`] service in the process, minus one day.
///
/// # Panics
///
@ -36,7 +36,7 @@ impl INSTANT {
if let Some(t) = *EPOCH.read() {
return t;
}
*EPOCH.write().get_or_insert_with(Instant::now)
*EPOCH.write().get_or_insert_with(|| Instant::now() - Duration::from_secs(60 * 60 * 24))
}
/// Defines how the `now` value updates.