shithub: rgbds

Download patch

ref: 4ed5ba750885b303bc31e17d48eb0e055bd88423
parent: 20a26599a3de9fa7c24f8daef7310721b2c2958a
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Thu Jan 27 17:32:34 EST 2022

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.

--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -760,7 +760,6 @@
 		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);
@@ -768,6 +767,8 @@
 	strftime(savedTIMESTAMP_ISO8601_LOCAL,
 		 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\"",