aboutsummaryrefslogtreecommitdiff
path: root/runit
diff options
context:
space:
mode:
Diffstat (limited to 'runit')
-rw-r--r--runit/svlogd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 412290ca9..13de2570f 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -347,11 +347,13 @@ static unsigned pmatch(const char *p, const char *s, unsigned len)
347/* NUL terminated */ 347/* NUL terminated */
348static void fmt_time_human_30nul(char *s, char dt_delim) 348static void fmt_time_human_30nul(char *s, char dt_delim)
349{ 349{
350 struct tm tm;
350 struct tm *ptm; 351 struct tm *ptm;
351 struct timeval tv; 352 struct timeval tv;
352 353
353 gettimeofday(&tv, NULL); 354 gettimeofday(&tv, NULL);
354 ptm = gmtime(&tv.tv_sec); 355 ptm = gmtime_r(&tv.tv_sec, &tm);
356 /* ^^^ using gmtime_r() instead of gmtime() to not use static data */
355 sprintf(s, "%04u-%02u-%02u%c%02u:%02u:%02u.%06u000", 357 sprintf(s, "%04u-%02u-%02u%c%02u:%02u:%02u.%06u000",
356 (unsigned)(1900 + ptm->tm_year), 358 (unsigned)(1900 + ptm->tm_year),
357 (unsigned)(ptm->tm_mon + 1), 359 (unsigned)(ptm->tm_mon + 1),