diff options
author | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-11-23 18:46:38 +0100 |
---|---|---|
committer | Lukas Fleischer <calcurse@cryptocrack.de> | 2012-11-23 19:03:57 +0100 |
commit | 1f0f05ecc1aae138b700df9ff2200abf4fd110f2 (patch) | |
tree | 1430bfcd2f79c47b2329c40320e67ecf3fa783c2 /src/recur.c | |
parent | 7733d52f3249fee2a1d875d6923b8d2506dea5e4 (diff) | |
parent | 0ea23c24bf06e153bb075804e195e1733fd67d3f (diff) | |
download | calcurse-1f0f05ecc1aae138b700df9ff2200abf4fd110f2.zip |
Merge branch 'maint'
Conflicts:
src/day.c
src/recur.c
Diffstat (limited to 'src/recur.c')
-rw-r--r-- | src/recur.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/src/recur.c b/src/recur.c index 3338017..1c593c2 100644 --- a/src/recur.c +++ b/src/recur.c @@ -300,17 +300,17 @@ int recur_char2def(char type) static void recur_write_exc(llist_t * lexc, FILE * f) { llist_item_t *i; - struct tm *lt; + struct tm lt; time_t t; int st_mon, st_day, st_year; LLIST_FOREACH(lexc, i) { struct excp *exc = LLIST_GET_DATA(i); t = exc->st; - lt = localtime(&t); - st_mon = lt->tm_mon + 1; - st_day = lt->tm_mday; - st_year = lt->tm_year + 1900; + localtime_r(&t, <); + st_mon = lt.tm_mon + 1; + st_day = lt.tm_mday; + st_year = lt.tm_year + 1900; fprintf(f, " !%02u/%02u/%04u", st_mon, st_day, st_year); } } @@ -397,27 +397,27 @@ struct recur_event *recur_event_scan(FILE * f, struct tm start, int id, /* Writting of a recursive appointment into file. */ void recur_apoint_write(struct recur_apoint *o, FILE * f) { - struct tm *lt; + struct tm lt; time_t t; t = o->start; - lt = localtime(&t); - fprintf(f, "%02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday, - 1900 + lt->tm_year, lt->tm_hour, lt->tm_min); + localtime_r(&t, <); + fprintf(f, "%02u/%02u/%04u @ %02u:%02u", lt.tm_mon + 1, lt.tm_mday, + 1900 + lt.tm_year, lt.tm_hour, lt.tm_min); t = o->start + o->dur; - lt = localtime(&t); - fprintf(f, " -> %02u/%02u/%04u @ %02u:%02u", lt->tm_mon + 1, lt->tm_mday, - 1900 + lt->tm_year, lt->tm_hour, lt->tm_min); + localtime_r(&t, <); + fprintf(f, " -> %02u/%02u/%04u @ %02u:%02u", lt.tm_mon + 1, lt.tm_mday, + 1900 + lt.tm_year, lt.tm_hour, lt.tm_min); t = o->rpt->until; if (t == 0) { /* We have an endless recurrent appointment. */ fprintf(f, " {%d%c", o->rpt->freq, recur_def2char(o->rpt->type)); } else { - lt = localtime(&t); + localtime_r(&t, <); fprintf(f, " {%d%c -> %02u/%02u/%04u", o->rpt->freq, - recur_def2char(o->rpt->type), lt->tm_mon + 1, lt->tm_mday, - 1900 + lt->tm_year); + recur_def2char(o->rpt->type), lt.tm_mon + 1, lt.tm_mday, + 1900 + lt.tm_year); } recur_write_exc(&o->exc, f); fputs("} ", f); @@ -433,25 +433,25 @@ void recur_apoint_write(struct recur_apoint *o, FILE * f) /* Writting of a recursive event into file. */ void recur_event_write(struct recur_event *o, FILE * f) { - struct tm *lt; + struct tm lt; time_t t; int st_mon, st_day, st_year; int end_mon, end_day, end_year; t = o->day; - lt = localtime(&t); - st_mon = lt->tm_mon + 1; - st_day = lt->tm_mday; - st_year = lt->tm_year + 1900; + localtime_r(&t, <); + st_mon = lt.tm_mon + 1; + st_day = lt.tm_mday; + st_year = lt.tm_year + 1900; t = o->rpt->until; if (t == 0) { /* We have an endless recurrent event. */ fprintf(f, "%02u/%02u/%04u [%d] {%d%c", st_mon, st_day, st_year, o->id, o->rpt->freq, recur_def2char(o->rpt->type)); } else { - lt = localtime(&t); - end_mon = lt->tm_mon + 1; - end_day = lt->tm_mday; - end_year = lt->tm_year + 1900; + localtime_r(&t, <); + end_mon = lt.tm_mon + 1; + end_day = lt.tm_mday; + end_year = lt.tm_year + 1900; fprintf(f, "%02u/%02u/%04u [%d] {%d%c -> %02u/%02u/%04u", st_mon, st_day, st_year, o->id, o->rpt->freq, recur_def2char(o->rpt->type), end_mon, end_day, end_year); @@ -563,10 +563,10 @@ recur_item_find_occurrence(long item_start, long item_dur, llist_t * item_exc, return 0; t = day_start; - lt_day = *localtime(&t); + localtime_r(&t, <_day); t = item_start; - lt_item = *localtime(&t); + localtime_r(&t, <_item); lt_item_day = lt_item; lt_item_day.tm_sec = lt_item_day.tm_min = lt_item_day.tm_hour = 0; @@ -614,7 +614,7 @@ recur_item_find_occurrence(long item_start, long item_dur, llist_t * item_exc, if (rpt_until != 0 && t > rpt_until) return 0; - lt_item_day = *localtime(&t); + localtime_r(&t, <_item_day); diff = diff_days(lt_item_day, lt_day); if (diff <= span) { |