From 46445638a8bfa06b90232dd88648b1f2f37104da Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 7 Jan 2020 09:28:42 +1000 Subject: [PATCH] fix days_elapsed moving backwards --- rslib/src/sched.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rslib/src/sched.rs b/rslib/src/sched.rs index 530b2eb6e..d3b8d466e 100644 --- a/rslib/src/sched.rs +++ b/rslib/src/sched.rs @@ -42,8 +42,7 @@ fn rollover_for_today( /// The number of times the day rolled over between two timestamps. fn days_elapsed(start: i64, end: i64, rollover_today: i64) -> u32 { - // get the number of full days that have elapsed - let secs = (end - start).max(0); + let secs = (rollover_today - start).max(0); let days = (secs / 86_400) as u32; // minus one if today's cutoff hasn't passed