diff --git a/src/main.rs b/src/main.rs index 32f7ef3..7b16144 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1168,9 +1168,12 @@ fn main() { let mut watchdog = time::OffsetDateTime::now_utc().unix_timestamp(); loop { let idle = test_idle(&config, start); - // If it's idle, the idle command hasn't already run, and it has been + let now = time::OffsetDateTime::now_utc().unix_timestamp(); + // Look for clock jumps that indicate the system slept. In this case dont run idle + // trigger. + // Otherwise if it's idle, the idle command hasn't already run, and it has been // at least |idle_time| since the service started: enter idle state. - if idle.is_idle && !idle_triggered { + if watchdog + 30 > now && idle.is_idle && !idle_triggered { let tests = test_nonidle(&config); if !tests.is_blocked { println!("Idle state active:\n{}{}", idle, tests);