# HG changeset patch # User Daniele Nicolodi # Date 1434459979 -7200 # Node ID 3622e24a443f5dd4248af953753751bc21496e3d # Parent 6c748ed6a7c549bf1f0e33fc3d912cd75d283b77 Also rotate log file at midnight UTC not local time diff -r 6c748ed6a7c5 -r 3622e24a443f logging.c --- 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))