From 4ed5ba750885b303bc31e17d48eb0e055bd88423 Mon Sep 17 00:00:00 2001 From: Rangi Date: Thu, 27 Jan 2022 22:32:34 -0500 Subject: [PATCH] Finish using time_utc before initializing time_local gmtime and localtime may share the same static internal struct tm, so they cannot both be initialized and then used. --- src/asm/symbol.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/asm/symbol.c b/src/asm/symbol.c index 9106c2bd..a5a74b7f 100644 --- a/src/asm/symbol.c +++ b/src/asm/symbol.c @@ -760,7 +760,6 @@ void sym_Init(time_t now) now = 0; } - const struct tm *time_utc = gmtime(&now); const struct tm *time_local = localtime(&now); strftime(savedTIME, sizeof(savedTIME), "\"%H:%M:%S\"", time_local); @@ -769,6 +768,8 @@ void sym_Init(time_t now) sizeof(savedTIMESTAMP_ISO8601_LOCAL), "\"%Y-%m-%dT%H:%M:%S%z\"", time_local); + const struct tm *time_utc = gmtime(&now); + strftime(savedTIMESTAMP_ISO8601_UTC, sizeof(savedTIMESTAMP_ISO8601_UTC), "\"%Y-%m-%dT%H:%M:%SZ\"", time_utc);