Yes, I have a way of forcing any piece of code to execute in any arbitrary length of time. I used this to predict the final outcome of the universe in less than two microseconds.
Originally Posted by Auradrummer
More seriously, you need to occassionally call a time-getting function to see if you're getting too far "ahead", sleeping if necessary. For instance, if each loop iteration takes dt seconds, then:
Where CurrentTime() gives the current time in seconds (double precision), slop is the maximum time you are allowed to overshoot (possibly 0.0), and WaitUntil() is a function which causes the program to sleep until the time is greater than or equal to t.
double t = CurrentTime();
if( t > CurrentTime() + slop )
WaitUntil( t );
t += dt;