• Create Account

### #ActualAshaman73

Posted 08 January 2013 - 09:33 AM

Here's an other method:

// all times are long given in ms
const long INTERVAL = 1000/frequency_in_Hz;
if( (current_time / INTERVAL)>(last_time/INTERVAL))
{
sendUpdate();
last_time = current_time;
}


This ensures that you sends at most X, equally spaced, updates per second, but less if your performances drops for some reasons.

### #1Ashaman73

Posted 08 January 2013 - 09:33 AM

Here's an other method:

// all times are long given in ms
const long INTERVAL = 1000/frequency_in_Hz;
if( (current_time / INTERVAL)>(last_time/INTERVAL))
{
sendUpdate();
last_time = current_time;
}


This ensures that you sends at most X, equally spaced, updates per second, but less if your performances drops for some reasons.

PARTNERS