summaryrefslogtreecommitdiff
path: root/src/event.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-11-23 18:46:38 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-11-23 19:03:57 +0100
commit1f0f05ecc1aae138b700df9ff2200abf4fd110f2 (patch)
tree1430bfcd2f79c47b2329c40320e67ecf3fa783c2 /src/event.c
parent7733d52f3249fee2a1d875d6923b8d2506dea5e4 (diff)
parent0ea23c24bf06e153bb075804e195e1733fd67d3f (diff)
downloadcalcurse-1f0f05ecc1aae138b700df9ff2200abf4fd110f2.zip
Merge branch 'maint'
Conflicts: src/day.c src/recur.c
Diffstat (limited to 'src/event.c')
-rw-r--r--src/event.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/event.c b/src/event.c
index 561c299..dca6820 100644
--- a/src/event.c
+++ b/src/event.c
@@ -107,13 +107,13 @@ unsigned event_inday(struct event *i, long *start)
/* Write to file the event in user-friendly format */
void event_write(struct event *o, FILE * f)
{
- struct tm *lt;
+ struct tm lt;
time_t t;
t = o->day;
- lt = localtime(&t);
- fprintf(f, "%02u/%02u/%04u [%d] ", lt->tm_mon + 1, lt->tm_mday,
- 1900 + lt->tm_year, o->id);
+ localtime_r(&t, &lt);
+ fprintf(f, "%02u/%02u/%04u [%d] ", lt.tm_mon + 1, lt.tm_mday,
+ 1900 + lt.tm_year, o->id);
if (o->note != NULL)
fprintf(f, ">%s ", o->note);
fprintf(f, "%s\n", o->mesg);
@@ -123,10 +123,7 @@ void event_write(struct event *o, FILE * f)
struct event *event_scan(FILE * f, struct tm start, int id, char *note)
{
char buf[BUFSIZ], *nl;
- time_t tstart, t;
-
- t = time(NULL);
- localtime(&t);
+ time_t tstart;
/* Read the event description */
if (!fgets(buf, sizeof buf, f))