diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-10-11 13:06:55 +0200 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2011-10-21 08:58:54 +0200 |
commit | 2bf02493385ffe5e51b5480e57f9643bc80b8267 (patch) | |
tree | 3c791cc59ef006c689c7c2bda79e3a2222ecf51b /src/notify.c | |
parent | 28c98f7d0136b4a533e26f076886aa242c709f1c (diff) | |
download | calcurse-2bf02493385ffe5e51b5480e57f9643bc80b8267.zip |
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 <calcurse@cryptocrack.de>
Diffstat (limited to 'src/notify.c')
-rw-r--r-- | src/notify.c | 15 |
1 files changed, 8 insertions, 7 deletions
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; |