aboutsummaryrefslogtreecommitdiffstats
path: root/src/apoint.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2017-08-28 06:56:12 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2017-08-28 07:06:06 +0200
commit7924315bfb8ae707b2b510b808377c79355ba6a2 (patch)
tree428a380a0d6d5553a4864e724fc32c6cc1eab52d /src/apoint.c
parente76b96c9ff162ada42863d4ec2d739bf874af113 (diff)
downloadcalcurse-7924315bfb8ae707b2b510b808377c79355ba6a2.tar.gz
calcurse-7924315bfb8ae707b2b510b808377c79355ba6a2.zip
Fix support for punctual appointments at 00:00
When checking whether an appointment belongs to a given day in apoint_inday(), the return value was 0 if the end time of the appointment matched 00:00 on that day (because we do not want to include appointments starting on the day before and lasting until midnight). However, this means that punctual appointments at 00:00 were not included in any day. Fix the apoint_inday() logic to take this into consideration. Fixes GitHub issue #39. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/apoint.c')
-rw-r--r--src/apoint.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/apoint.c b/src/apoint.c
index d5d9dc3..a1c4934 100644
--- a/src/apoint.c
+++ b/src/apoint.c
@@ -119,8 +119,9 @@ 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 &&
- date_cmp_day(i->start + i->dur - 1, *start) >= 0);
+ return (date_cmp_day(i->start, *start) == 0 ||
+ (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)