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/apoint.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/apoint.c')
-rw-r--r-- | src/apoint.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/apoint.c b/src/apoint.c index 9860038..a756fac 100644 --- a/src/apoint.c +++ b/src/apoint.c @@ -137,39 +137,39 @@ unsigned apoint_inday(struct apoint *i, long *start) void apoint_sec2str(struct apoint *o, long day, char *start, char *end) { - struct tm *lt; + struct tm lt; time_t t; if (o->start < day) strncpy(start, "..:..", 6); else { t = o->start; - lt = localtime(&t); - snprintf(start, HRMIN_SIZE, "%02u:%02u", lt->tm_hour, lt->tm_min); + localtime_r(&t, <); + snprintf(start, HRMIN_SIZE, "%02u:%02u", lt.tm_hour, lt.tm_min); } if (o->start + o->dur > day + DAYINSEC) strncpy(end, "..:..", 6); else { t = o->start + o->dur; - lt = localtime(&t); - snprintf(end, HRMIN_SIZE, "%02u:%02u", lt->tm_hour, lt->tm_min); + localtime_r(&t, <); + snprintf(end, HRMIN_SIZE, "%02u:%02u", lt.tm_hour, lt.tm_min); } } void apoint_write(struct 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); if (o->note != NULL) fprintf(f, ">%s ", o->note); @@ -186,10 +186,7 @@ struct apoint *apoint_scan(FILE * f, struct tm start, struct tm end, char state, char *note) { char buf[BUFSIZ], *newline; - time_t tstart, tend, t; - - t = time(NULL); - localtime(&t); + time_t tstart, tend; /* Read the appointment description */ if (!fgets(buf, sizeof buf, f)) |