From 5b96f2ccb76ae432b1880631520f25a7cb170a1b Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sun, 12 Jul 2015 00:08:56 +0200
Subject: degesch: fix the date change timer
It used absolute time, while we need relative.
---
degesch.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/degesch.c b/degesch.c
index 58bbbb0..2388080 100644
--- a/degesch.c
+++ b/degesch.c
@@ -9035,9 +9035,10 @@ static void
rearm_date_change_timer (struct app_context *ctx)
{
const time_t seconds_per_day = 60 * 60 * 12;
- poller_timer_set (&ctx->date_chg_tmr,
- (time (NULL) + seconds_per_day - 1)
- / seconds_per_day * seconds_per_day * 1000);
+ const time_t now = time (NULL);
+ const time_t midnight = (now + seconds_per_day - 1)
+ / seconds_per_day * seconds_per_day;
+ poller_timer_set (&ctx->date_chg_tmr, (midnight - now) * 1000);
}
static void
--
cgit v1.2.3-70-g09d2