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.
@@ -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);
