[vlc-commits] ts: use timezone and fix thread-safety

Rémi Denis-Courmont git at videolan.org
Sat Aug 16 10:18:50 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Aug 16 11:13:31 2014 +0300| [3b0f342ffb3bf3ccee5333a2808eec4d303e731d] | committer: Rémi Denis-Courmont

ts: use timezone and fix thread-safety

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3b0f342ffb3bf3ccee5333a2808eec4d303e731d
---

 modules/demux/ts.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/demux/ts.c b/modules/demux/ts.c
index d472693..778818f 100644
--- a/modules/demux/ts.c
+++ b/modules/demux/ts.c
@@ -3111,12 +3111,11 @@ static void EITCallBack( demux_t *p_demux,
             if( p_sys->i_tdt_delta == 0 )
                 p_sys->i_tdt_delta = CLOCK_FREQ * (i_start + i_duration - 5) - mdate();
 
-            //i_start -= 9 * 60 * 60; // JST -> UTC
-            time_t timer = time( NULL );
-            int64_t diff = difftime( mktime( localtime( &timer ) ),
-                                     mktime( gmtime( &timer ) ) );
-            i_start -= diff;
-            i_tot_time = (mdate() + p_sys->i_tdt_delta) / CLOCK_FREQ - diff;
+            i_tot_time = (mdate() + p_sys->i_tdt_delta) / CLOCK_FREQ;
+
+            tzset(); // JST -> UTC
+            i_start += timezone; // FIXME: what about DST?
+            i_tot_time += timezone;
 
             if( p_evt->i_running_status == 0x00 &&
                 (i_start - 5 < i_tot_time &&



More information about the vlc-commits mailing list