So, a better system was needed, so I decided to look into using boost::thread::sleep() to sleep for a set amount of time instead of just yeilding and seeing if the correct amount of time has passed.
However, boost::thread::sleep() doesnt take an amount of time to sleep for, it takes a time to sleep until using a platform independant boost::xtime type varible. So off to google I go and discover this wonderfull bit of code in the spirit library (also in boost) which lets you sleep for a given amount of milliseconds;
milli_sleep(unsigned long milliseconds)
static long const nanoseconds_per_second = 1000L*1000L*1000L;
while (xt.nsec > nanoseconds_per_second)
xt.nsec -= nanoseconds_per_second;
So, I made a quick change to my update loop, removing the check for the time passing and changing boost::yeild() for milli_sleep(10) as 10ms was how long I was using as a time delta. Recompiled and ran it and got a SOILD 25 updates per second out of it, infact it only varied above very slightly. Changing the time from 10 to 5 resulted in a soild 50 updates per second.
To say I'm impressed is an understatement, I need to find a way of stressing the system to see if that holds, but right now I'm pretty impressed and happy that I've got a slightly more stable update speed.
I do need to perform a check on the times its throwing out however, just to make sure they are the correct time apart, however the maths says they should be so I dont expect any problems with it [grin]
While it does appear to do 50 updates per second the sleep method drifts off the tick and introducing a loop to correct it seems to slow things down to 25 updates per second, which isnt overly usefull. As such I've reverted back to my orignal loop, however a change in my state swapping code appears to have removed and jitters (it checks to make sure the next update is newer than the current, if it isnt it doesnt swap and the linear interpolation appears to turn into extrapolation, which appears to work well for my rotating cubes, I dont know how it will react in a real world situation however.