From 2bf02493385ffe5e51b5480e57f9643bc80b8267 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Tue, 11 Oct 2011 13:06:55 +0200 Subject: Avoid unnecessary start time calculations Rename recur_*_inday() to recur_*_find_occurrence() and use the new functions whenever we actually care about the start time of an occurrence. Reintroduce recur_*_inday() as wrappers to recur_*_find_occurrence() and pass NULL as start time buffer (which means "skip start time calculation"). Keep using these when we only want to know if a recurrent item belongs to a specific day but do not care about the actual start time. Signed-off-by: Lukas Fleischer --- src/notify.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/notify.c') diff --git a/src/notify.c b/src/notify.c index e1a7dab..bf0fd29 100644 --- a/src/notify.c +++ b/src/notify.c @@ -507,15 +507,15 @@ notify_check_added (char *mesg, long start, char state) void notify_check_repeated (struct recur_apoint *i) { - long real_app_time; + unsigned real_app_time; int update_notify = 0; time_t current_time; current_time = time (NULL); pthread_mutex_lock (¬ify_app.mutex); - if ((real_app_time = recur_item_inday (i->start, i->dur, &i->exc, - i->rpt->type, i->rpt->freq, - i->rpt->until, get_today ()))) + if (recur_item_find_occurrence (i->start, i->dur, &i->exc, i->rpt->type, + i->rpt->freq, i->rpt->until, get_today (), + &real_app_time)) { if (!notify_app.got_app) { @@ -556,10 +556,11 @@ int notify_same_recur_item (struct recur_apoint *i) { int same = 0; - long item_start = 0; + unsigned item_start = 0; - item_start = recur_item_inday (i->start, i->dur, &i->exc, i->rpt->type, - i->rpt->freq, i->rpt->until, get_today ()); + recur_item_find_occurrence (i->start, i->dur, &i->exc, i->rpt->type, + i->rpt->freq, i->rpt->until, get_today (), + &item_start); pthread_mutex_lock (¬ify_app.mutex); if (notify_app.got_app && item_start == notify_app.time) same = 1; -- cgit v1.2.3-54-g00ecf