Commit ac15b24b authored by Rémi Duraffort's avatar Rémi Duraffort

Don't call mdate too many times.

parent 98ea2ba6
......@@ -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 )
{
......
......@@ -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;
......
......@@ -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));
......
......@@ -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 )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment