pango: Call tzset() before localtime_r()
authorHans-Peter Nilsson <hp@gcc.gnu.org>
Sun, 5 Jul 2009 16:01:38 +0000 (18:01 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Sun, 5 Jul 2009 16:01:38 +0000 (18:01 +0200)
POSIX and your local friendly ctime(3) manual entry says that localtime_r isn't
required to set the state variables that define the current timezone.  Indeed,
glibc (at least 2.9) doesn't do this for subsequent calls.  The effect is that
if the system timezone is changed for a running program between two calls to
gst_clock_overlay_render_time, it won't be noticed.  For glibc, changing the
timezone equals /etc/localtime being modified.

Fixes bug #587676.

ext/pango/gstclockoverlay.c

index 4a1330f..76b7b59 100644 (file)
@@ -97,6 +97,9 @@ gst_clock_overlay_render_time (GstClockOverlay * overlay)
   now = time (NULL);
 
 #ifdef HAVE_LOCALTIME_R
+  /* Need to call tzset explicitly when calling localtime_r for changes
+     to the timezone between calls to be visible.  */
+  tzset ();
   t = localtime_r (&now, &dummy);
 #else
   /* on win32 this apparently returns a per-thread struct which would be fine */