Hi all,
I think there is a minor bug in ulClock, causing the first reported delta after a reset() to be wrong. Reset basically sets:
start = getRawTime () ;
now = start ;
delta = 1.0 / 30.0 ; /* Faked so stoopid programs won't div0 */
last_time = now - delta ;
So basically 'now' and 'last_time' are in 'seconds since epoch'.
But in update():
now = getRawTime() - start ;
delta = now - last_time ;
[...]
if ( delta <= 0.0 ) delta = 0.0000001 ;
last_time = now ;
So here 'now' gets set to second since reset() (not since epoch), and delta therefor becomes a huge negative number, which then gets clamped. 'last_time' then gets set to seconds since start, and from then on everything works fine.
Easy solution seems to be to set last_time in reset() to 0.
Best regards,
Joerg
|