diff options
author | Lukas Fleischer <lfleischer@calcurse.org> | 2017-08-28 06:56:12 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@calcurse.org> | 2017-08-28 07:06:06 +0200 |
commit | 7924315bfb8ae707b2b510b808377c79355ba6a2 (patch) | |
tree | 428a380a0d6d5553a4864e724fc32c6cc1eab52d | |
parent | e76b96c9ff162ada42863d4ec2d739bf874af113 (diff) | |
download | calcurse-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>
-rw-r--r-- | src/apoint.c | 5 |
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) |