diff options
author | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-05-14 13:50:52 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2009-05-14 13:55:56 +0200 |
commit | 6e0ff31e073c7951d606244b9ff1292f6247fb61 (patch) | |
tree | 3d34a4390c3c3d2f152dd3e8b9af2661ee6d3c19 /src/pluto/log.c | |
parent | 7eea232f449c19048197eca0b010ccfef675d92f (diff) | |
download | strongswan-6e0ff31e073c7951d606244b9ff1292f6247fb61.tar.bz2 strongswan-6e0ff31e073c7951d606244b9ff1292f6247fb61.tar.xz |
use localtime_r() instead of localtime()
Diffstat (limited to 'src/pluto/log.c')
-rw-r--r-- | src/pluto/log.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/pluto/log.c b/src/pluto/log.c index f6eee8cc9..63d953aea 100644 --- a/src/pluto/log.c +++ b/src/pluto/log.c @@ -880,22 +880,18 @@ daily_log_reset(void) void daily_log_event(void) { - struct tm *ltime; - time_t n, interval; + struct tm lt; + time_t t, interval; /* attempt to schedule oneself to midnight, local time * do this by getting seconds in the day, and delaying - * by 86400 - hour*3600+minutes*60+seconds. + * by 86400 - 3600*hours - 60*minutes - seconds. */ - time(&n); - ltime = localtime(&n); - interval = (24 * 60 * 60) - - (ltime->tm_sec - + ltime->tm_min * 60 - + ltime->tm_hour * 3600); + time(&t); + localtime_r(&t, <); + interval = 3600 * (24 - lt.tm_hour) - 60 * lt.tm_min - lt.tm_sec; event_schedule(EVENT_LOG_DAILY, interval, NULL); - daily_log_reset(); } |