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>
This commit is contained in:
Lukas Fleischer 2017-08-28 06:56:12 +02:00
parent e76b96c9ff
commit 7924315bfb

View File

@ -119,8 +119,9 @@ struct apoint *apoint_new(char *mesg, char *note, long start, long dur,
unsigned apoint_inday(struct apoint *i, long *start) 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); (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) void apoint_sec2str(struct apoint *o, long day, char *start, char *end)