mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-28 08:20:40 +02:00
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:
parent
48466f3a61
commit
23c78b429f
@ -1392,6 +1392,7 @@ _g_localtime (time_t timet, struct tm *out_tm)
|
|||||||
gboolean success = TRUE;
|
gboolean success = TRUE;
|
||||||
|
|
||||||
#ifdef HAVE_LOCALTIME_R
|
#ifdef HAVE_LOCALTIME_R
|
||||||
|
tzset ();
|
||||||
if (!localtime_r (&timet, out_tm))
|
if (!localtime_r (&timet, out_tm))
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user