From 4633846550a1efd3a758e51551b6a93446b2297d Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <lfleischer@calcurse.org>
Date: Mon, 28 Mar 2016 08:45:49 +0200
Subject: Fix apoint_inday() with long appointments

Fixes a regression introduced in 9e160fa (Do not assume that days always
have 86400 seconds, 2016-03-27).

Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
---
 src/apoint.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/apoint.c b/src/apoint.c
index 409e889..97f23fb 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -119,7 +119,8 @@ struct apoint *apoint_new(char *mesg, char *note, long start, long dur,
 
 unsigned apoint_inday(struct apoint *i, long *start)
 {
-	return (date_cmp_day(i->start, *start) == 0);
+	return (date_cmp_day(i->start, *start) <= 0 &&
+		date_cmp_day(i->start + i->dur - 1, *start) >= 0);
 }
 
 void apoint_sec2str(struct apoint *o, long day, char *start, char *end)
-- 
cgit v1.2.3-70-g09d2