diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/io.c | 26 | ||||
-rwxr-xr-x | src/recur.c | 20 | ||||
-rwxr-xr-x | src/recur.h | 3 |
3 files changed, 19 insertions, 30 deletions
@@ -1,4 +1,4 @@ -/* $calcurse: io.c,v 1.47 2008/12/12 20:44:50 culot Exp $ */ +/* $calcurse: io.c,v 1.48 2008/12/14 11:24:19 culot Exp $ */ /* * Calcurse - text-based organizer @@ -238,7 +238,8 @@ get_export_stream (export_type_t type) return (stream); } -/* Travel through each occurence of an item, and execute the given callback +/* + * Travel through each occurence of an item, and execute the given callback * (mainly used to export data). */ static void @@ -246,14 +247,23 @@ foreach_date_dump (const long date_end, struct rpt_s *rpt, struct days_s *exc, long item_first_date, long item_dur, char *item_mesg, cb_dump_t cb_dump, FILE *stream) { - long date; + long date, item_time; + struct tm lt; + time_t t; + + t = item_first_date; + lt = *localtime (&t); + lt.tm_hour = lt.tm_min = lt.tm_sec = 0; + lt.tm_isdst = -1; + date = mktime (<); + item_time = item_first_date - date; - date = item_first_date; while (date <= date_end && date <= rpt->until) { - if (!recur_day_is_exc (date, exc)) + if (recur_item_inday (item_first_date, exc, rpt->type, rpt->freq, + rpt->until, date)) { - (*cb_dump)(stream, date, item_dur, item_mesg); + (*cb_dump)(stream, date + item_time, item_dur, item_mesg); } switch (rpt->type) { @@ -270,9 +280,7 @@ foreach_date_dump (const long date_end, struct rpt_s *rpt, struct days_s *exc, date = date_sec_change (date, rpt->freq * 12, 0); break; default: - fputs (_("FATAL ERROR in foreach_date_dump: " - "incoherent repetition type\n"), stderr); - exit (EXIT_FAILURE); + EXIT (_("incoherent repetition type")); /* NOTREACHED */ break; } diff --git a/src/recur.c b/src/recur.c index eb98431..339f282 100755 --- a/src/recur.c +++ b/src/recur.c @@ -1,4 +1,4 @@ -/* $calcurse: recur.c,v 1.43 2008/12/13 21:41:25 culot Exp $ */ +/* $calcurse: recur.c,v 1.44 2008/12/14 11:24:19 culot Exp $ */ /* * Calcurse - text-based organizer @@ -403,24 +403,6 @@ recur_save_data (FILE *f) pthread_mutex_unlock (&(recur_alist_p->mutex)); } -/* Given a day as long, check if this day belongs to the list of exceptions for - * the considered item. - */ -int -recur_day_is_exc (long day, struct days_s *item_exc) -{ - const int NOT_EXC = 0; - const int EXC = 1; - struct days_s *exc; - - for (exc = item_exc; exc != 0; exc = exc->next) - { - if (exc->st == day) - return EXC; - } - return NOT_EXC; -} - /* * Check if the recurrent item belongs to the selected day, * and if yes, return the real start time. diff --git a/src/recur.h b/src/recur.h index eade3da..286b1ee 100755 --- a/src/recur.h +++ b/src/recur.h @@ -1,4 +1,4 @@ -/* $calcurse: recur.h,v 1.22 2008/09/16 19:41:36 culot Exp $ */ +/* $calcurse: recur.h,v 1.23 2008/12/14 11:24:19 culot Exp $ */ /* * Calcurse - text-based organizer @@ -100,7 +100,6 @@ struct recur_event_s *recur_event_scan (FILE *, struct tm, int, char, int, struct tm, char *, struct days_s *); void recur_save_data (FILE *); -int recur_day_is_exc (long, struct days_s *); unsigned recur_item_inday (long, struct days_s *, int, int, long, long); void recur_event_erase (long, unsigned, unsigned, |