From e6cffdc6bd58e0ddefbb0b21e8bbe841963bce48 Mon Sep 17 00:00:00 2001 From: Lars Henriksen Date: Tue, 30 Oct 2018 19:53:55 +0100 Subject: DST fix: daylength v. DAYINSEC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The number of seconds in a day and daylength in seconds differ when Daylight Saving Time is in effect on two days of the year. The day when DST takes effect is 23 hours long, and the day when DST ends is 25 hours long. In the latter case the date changing thread wóuld enter a loop in the last hour before midnight (in the former it would set the date an hour too late). The next midnight is calculated through mktime(), invoked by date2sec(). Wrong daylength prevented appointments from being stored in the day vector and caused them to be displayed wrongly in the appts panel. Signed-off-by: Lukas Fleischer --- src/ui-calendar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui-calendar.c') diff --git a/src/ui-calendar.c b/src/ui-calendar.c index 7d464dd..a668efb 100644 --- a/src/ui-calendar.c +++ b/src/ui-calendar.c @@ -97,7 +97,7 @@ static void *ui_calendar_date_thread(void *arg) time_t actual, tomorrow; for (;;) { - tomorrow = (time_t) (get_today() + DAYINSEC); + tomorrow = date2sec(today, 24, 0); while ((actual = time(NULL)) < tomorrow) sleep(tomorrow - actual); -- cgit v1.2.3-54-g00ecf