Mercurial > hg > fxanalyse
diff logging.c @ 260:3622e24a443f
Also rotate log file at midnight UTC not local time
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Tue, 16 Jun 2015 15:06:19 +0200 |
parents | d948e3ced2b9 |
children |
line wrap: on
line diff
--- a/logging.c Tue Jun 16 14:33:36 2015 +0200 +++ b/logging.c Tue Jun 16 15:06:19 2015 +0200 @@ -41,14 +41,17 @@ } -static int rotate(struct logger *l, struct tm *t) +static int rotate(struct logger *l, time_t now) { int len, rv; char id[7]; + struct tm *t; if (! l->dirpath) return 0; + /* utc day */ + t = gmtime(&now); if (l->yday == t->tm_yday) return 0; @@ -147,7 +150,7 @@ msg[len] = '\0'; /* rotate log file based on current date */ - rotate(l, t); + rotate(l, now); /* write to log file */ if ((level <= l->level) && (l->fd >= 0))