gdate: Call tzset before localtime_r

From `man 3 ctime`:
  According to POSIX.1, localtime() is required to behave as though tzset(3)
  was called, while localtime_r() does not have this requirement.
  For portable code, tzset(3) should be called before localtime_r().
This commit is contained in:
Alessandro Astone 2025-04-30 16:04:34 +02:00 committed by Philip Withnall
parent 48466f3a61
commit 23c78b429f

View File

@ -1392,6 +1392,7 @@ _g_localtime (time_t timet, struct tm *out_tm)
gboolean success = TRUE;
#ifdef HAVE_LOCALTIME_R
tzset ();
if (!localtime_r (&timet, out_tm))
success = FALSE;
#else