From fba7f29a7d5e649d91ac1edd09b70ee28b22743e Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Thu, 3 May 2018 18:42:18 +0200 Subject: unset tm_isdst before doing date operations Else mktime(3) can change tm_hour due to DST change. --- snooze.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'snooze.c') diff --git a/snooze.c b/snooze.c index c08cdc3..1dda3eb 100644 --- a/snooze.c +++ b/snooze.c @@ -182,11 +182,14 @@ next_day: tm->tm_mday++; } + tm->tm_isdst = -1; tm->tm_sec = 0; tm->tm_min = 0; tm->tm_hour = 0; t = mktime(tm); + tm->tm_isdst = -1; + if (t > from+(366*24*60*60)) // no result within a year return -1; } -- cgit v1.2.3