From e460a67bb4a313e5b36ce9ac87eabb2affc55259 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 7 Apr 2022 23:01:01 +0200 Subject: [PATCH] Fix overtime computation logic broken in PR #1312 Signed-off-by: DL6ER --- src/overTime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overTime.c b/src/overTime.c index 93734029..786f0bd8 100644 --- a/src/overTime.c +++ b/src/overTime.c @@ -71,8 +71,8 @@ void initOverTime(void) time_t now = time(NULL); // Get the centered timestamp of the current timestamp - time_t first_slot_ts = now - now % OVERTIME_INTERVAL + (OVERTIME_INTERVAL / 2); - time_t last_slot_ts = first_slot_ts + (OVERTIME_SLOTS-1) * OVERTIME_INTERVAL; + const time_t last_slot_ts = now - now % OVERTIME_INTERVAL + (OVERTIME_INTERVAL / 2); + const time_t first_slot_ts = last_slot_ts - (OVERTIME_SLOTS-1) * OVERTIME_INTERVAL; if(config.debug & DEBUG_OVERTIME) logg("initOverTime(): Initializing %i slots from %llu to %llu",