[vlc-devel] commit: Don't call mdate too many times. ( Rémi Duraffort )
git version control
git at videolan.org
Tue Aug 19 22:24:25 CEST 2008
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Tue Aug 19 22:18:51 2008 +0200| [ac15b24be029a27ca7bdec62dc740c72c2ddaee0] | committer: Rémi Duraffort
Don't call mdate too many times.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ac15b24be029a27ca7bdec62dc740c72c2ddaee0
---
modules/misc/logger.c | 5 +++--
modules/services_discovery/sap.c | 5 +++--
modules/visualization/galaktos/plugin.c | 7 ++++---
src/misc/stats.c | 5 +++--
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/modules/misc/logger.c b/modules/misc/logger.c
index 4229fa2..7bdefc1 100644
--- a/modules/misc/logger.c
+++ b/modules/misc/logger.c
@@ -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 )
{
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 7db0acd..ec84aa9 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -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;
diff --git a/modules/visualization/galaktos/plugin.c b/modules/visualization/galaktos/plugin.c
index 5daff78..729390c 100644
--- a/modules/visualization/galaktos/plugin.c
+++ b/modules/visualization/galaktos/plugin.c
@@ -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));
diff --git a/src/misc/stats.c b/src/misc/stats.c
index db0d13d..d6302bd 100644
--- a/src/misc/stats.c
+++ b/src/misc/stats.c
@@ -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 )
{
More information about the vlc-devel
mailing list