mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 07:16:55 +00:00
clockoverlay: fix bogus time display caused by previous commit
Fixes regression introduced by "clean-up" done as part of commit 98ebcb4
.
dummy must live as long as use the return value of localtime_r() since
that's just a pointer to it, and by putting it inside the block we made
dummy go out of scope right after localtime_r() returned, which messed
up the time values since when we poked at the struct the contents might
already have been overwritten.
Fixes #722
This commit is contained in:
parent
19b7b248cc
commit
37c996dcf4
1 changed files with 7 additions and 8 deletions
|
@ -75,6 +75,9 @@ static void gst_clock_overlay_get_property (GObject * object, guint prop_id,
|
|||
static gchar *
|
||||
gst_clock_overlay_render_time (GstClockOverlay * overlay)
|
||||
{
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
struct tm dummy;
|
||||
#endif
|
||||
struct tm *t;
|
||||
time_t now;
|
||||
gchar buf[256];
|
||||
|
@ -82,14 +85,10 @@ gst_clock_overlay_render_time (GstClockOverlay * overlay)
|
|||
now = time (NULL);
|
||||
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
{
|
||||
struct tm dummy;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
/* 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 */
|
||||
t = localtime (&now);
|
||||
|
|
Loading…
Reference in a new issue