From 9e160fac16e81c42ac368f450b9cc4df29753e00 Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <lfleischer@calcurse.org>
Date: Sun, 27 Mar 2016 12:54:10 +0200
Subject: Do not assume that days always have 86400 seconds

Make that date membership is computed correctly, even if a day has less
than 86400 seconds (e.g. after changing clocks).

Reported-by: Hakan Jerning <jerning@home.se>
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
---
 src/recur.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/recur.c')

diff --git a/src/recur.c b/src/recur.c
index 186acbe..10a2623 100644
--- a/src/recur.c
+++ b/src/recur.c
@@ -683,7 +683,7 @@ static long diff_years(struct tm lt_start, struct tm lt_end)
 
 static int exc_inday(struct excp *exc, long *day_start)
 {
-	return (exc->st >= *day_start && exc->st < *day_start + DAYINSEC);
+	return (date_cmp_day(exc->st, *day_start) == 0);
 }
 
 /*
@@ -706,7 +706,7 @@ recur_item_find_occurrence(long item_start, long item_dur,
 	struct tm lt_day, lt_item, lt_item_day;
 	time_t t;
 
-	if (day_start < item_start - DAYINSEC + 1)
+	if (date_cmp_day(day_start, item_start) < 0)
 		return 0;
 
 	if (rpt_until != 0 && day_start >= rpt_until + item_dur)
-- 
cgit v1.2.3