aboutsummaryrefslogtreecommitdiffstats
path: root/src/event.c
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@calcurse.org>2015-05-20 13:28:23 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2015-05-20 13:30:16 +0200
commit41b3ab7d17866ba01a378d88a970c494c7600c48 (patch)
tree320345906de44ddd5c8588da6494c506ec7b5568 /src/event.c
parent794e9509426ef4671914e29cb2fd877db3a61445 (diff)
downloadcalcurse-41b3ab7d17866ba01a378d88a970c494c7600c48.tar.gz
calcurse-41b3ab7d17866ba01a378d88a970c494c7600c48.zip
Add support for --filter-end-* to events
A natural convention is to specify the end time of an event as 23:59:59 on the day it is scheduled. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'src/event.c')
-rw-r--r--src/event.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/event.c b/src/event.c
index e8694ed..3918ce3 100644
--- a/src/event.c
+++ b/src/event.c
@@ -124,7 +124,7 @@ struct event *event_scan(FILE * f, struct tm start, int id, char *note,
struct item_filter *filter)
{
char buf[BUFSIZ], *nl;
- time_t tstart;
+ time_t tstart, tend;
EXIT_IF(!check_date(start.tm_year, start.tm_mon, start.tm_mday) ||
!check_time(start.tm_hour, start.tm_min),
@@ -147,6 +147,7 @@ struct event *event_scan(FILE * f, struct tm start, int id, char *note,
tstart = mktime(&start);
EXIT_IF(tstart == -1, _("date error in the event\n"));
+ tend = tstart + DAYINSEC - 1;
/* Filter item. */
if (filter) {
@@ -158,6 +159,10 @@ struct event *event_scan(FILE * f, struct tm start, int id, char *note,
return NULL;
if (filter->start_to >= 0 && tstart > filter->start_to)
return NULL;
+ if (filter->end_from >= 0 && tend < filter->end_from)
+ return NULL;
+ if (filter->end_to >= 0 && tend > filter->end_to)
+ return NULL;
}
return event_new(buf, note, tstart, id);