]> git.sesse.net Git - vlc/commitdiff
Don't call mdate too many times.
authorRémi Duraffort <ivoire@videolan.org>
Tue, 19 Aug 2008 20:18:51 +0000 (22:18 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 19 Aug 2008 20:24:52 +0000 (22:24 +0200)
modules/misc/logger.c
modules/services_discovery/sap.c
modules/visualization/galaktos/plugin.c
src/misc/stats.c

index 4229fa22d8281b9863a2ba36e4f8d3b944369a93..7bdefc164bf71263aa0d907b33db949544856aa5 100644 (file)
@@ -435,9 +435,10 @@ static void HtmlPrint( const msg_item_t *p_msg, FILE *p_file )
 
 static void DoRRD( intf_thread_t *p_intf )
 {
-    if( mdate() - p_intf->p_sys->last_update < 1000000 )
+    mtime_t now = mdate();
+    if( now - p_intf->p_sys->last_update < 1000000 )
         return;
-    p_intf->p_sys->last_update = mdate();
+    p_intf->p_sys->last_update = now;
 
     if( p_intf->p_libvlc->p_stats )
     {
index 7db0acda43a0d91301cb99c167b7d93839b5de1e..ec84aa964e2cbc2b4197e3fdc7ac45ef9ee9379d 100644 (file)
@@ -820,8 +820,9 @@ static int ParseSAP( services_discovery_t *p_sd, const uint8_t *buf,
                     p_announce->i_period_trust++;
 
                 /* Compute the average period */
-                p_announce->i_period = (p_announce->i_period + (mdate() - p_announce->i_last)) / 2;
-                p_announce->i_last = mdate();
+                mtime_t now = mdate();
+                p_announce->i_period = (p_announce->i_period + (now - p_announce->i_last)) / 2;
+                p_announce->i_last = now;
             }
             FreeSDP( p_sdp ); p_sdp = NULL;
             return VLC_SUCCESS;
index 5daff78afd06f0e24e03f42cbe83ec61ca44d81c..729390c7a046f012ce6b1f06c1c8040c7db44551 100644 (file)
@@ -248,14 +248,15 @@ static void* Thread( vlc_object_t *p_this )
         free( p_thread->psz_title );
         p_thread->psz_title = NULL;
 
+        mtime_t now = mdate();
         if (++count%100==0)
         {
-            realfps=100/((mdate()/1000-fpsstart)/1000);
+            realfps=100/((now/1000-fpsstart)/1000);
  //           printf("%f\n",realfps);
-            fpsstart=mdate()/1000;
+            fpsstart=now/1000;
         }
         //framerate limiter
-        timed=mspf-(mdate()/1000-timestart);
+        timed=mspf-(now/1000-timestart);
       //   printf("%d,%d\n",time,mspf);
         if (timed>0) msleep(1000*timed);
     //     printf("Limiter %d\n",(mdate()/1000-timestart));
index db0d13d6609bc6c530db9c4978e79f96a3c2aaa2..d6302bd887cc9ca058b0c813834e940486e51a7a 100644 (file)
@@ -513,11 +513,12 @@ static int CounterUpdate( vlc_object_t *p_handler,
     case STATS_DERIVATIVE:
     {
         counter_sample_t *p_new, *p_old;
-        if( mdate() - p_counter->last_update < p_counter->update_interval )
+        mtime_t now = mdate();
+        if( now - p_counter->last_update < p_counter->update_interval )
         {
             return VLC_EGENERIC;
         }
-        p_counter->last_update = mdate();
+        p_counter->last_update = now;
         if( p_counter->i_type != VLC_VAR_FLOAT &&
             p_counter->i_type != VLC_VAR_INTEGER )
         {