From 3a1c25bb19d5dbb5511de456e8a15db70f3344be Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 5 May 2024 12:08:38 -0400 Subject: [PATCH] Fix min/max. --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index a188a1b..811bc54 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,9 +44,9 @@ fn main() -> Result<(), Box> { } let time_until_next_action = db_conn.get_time_until_next_action()?; - let sleep_duration = std::cmp::min( + let sleep_duration = std::cmp::max( time::Duration::from_secs(60), - std::cmp::max(time_until_next_action, time::Duration::from_secs(300)), + std::cmp::min(time_until_next_action, time::Duration::from_secs(300)), ); println!("Sleeping for {} seconds.", sleep_duration.as_secs()); thread::sleep(sleep_duration);