From 04e23f2d6a3ca3b10e609e6084e52746c16e208a Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Sun, 5 Jul 2009 18:01:38 +0200 Subject: [PATCH] pango: Call tzset() before localtime_r() 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/pango/gstclockoverlay.c b/ext/pango/gstclockoverlay.c index 4a1330fb97..76b7b593cf 100644 --- a/ext/pango/gstclockoverlay.c +++ b/ext/pango/gstclockoverlay.c @@ -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 */