mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user