From d598fa76a79d9dd2723cfd7852ed94987e7af8e9 Mon Sep 17 00:00:00 2001 From: Martin Lund Date: Tue, 5 Jul 2022 16:49:56 +0200 Subject: [PATCH] Fix timestamp miliseconds bug --- src/misc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/misc.c b/src/misc.c index 1a61eb9..7e8ffbd 100644 --- a/src/misc.c +++ b/src/misc.c @@ -55,7 +55,8 @@ char *current_time(void) case TIMESTAMP_NONE: case TIMESTAMP_24HOUR: // "hh:mm:ss.sss" (24 hour format) - tm = localtime(&tv_now.tv_sec); + tv = tv_now; + tm = localtime(&tv.tv_sec); len = strftime(time_string, sizeof(time_string), "%H:%M:%S", tm); break; case TIMESTAMP_24HOUR_START: @@ -74,7 +75,8 @@ char *current_time(void) break; case TIMESTAMP_ISO8601: // "YYYY-MM-DDThh:mm:ss.sss" (ISO-8601) - tm = localtime(&tv_now.tv_sec); + tv = tv_now; + tm = localtime(&tv.tv_sec); len = strftime(time_string, sizeof(time_string), "%Y-%m-%dT%H:%M:%S", tm); break; default: