RE: [Plib-devel] [BUG] Minor bug in ulClock
Brought to you by:
sjbaker
From: Fay J. F C. AAC/W. <joh...@eg...> - 2005-07-16 16:53:38
|
OK, I think I fixed that. (Did I say this already? I confuse easily these days.) John F. Fay Technical Fellow, Jacobs/Sverdrup TEAS Group joh...@eg... 850-729-6330 -----Original Message----- From: pli...@li... [mailto:pli...@li...] On Behalf Of jo...@lu... Sent: Monday, July 11, 2005 10:07 PM To: pli...@li... Subject: [Plib-devel] [BUG] Minor bug in ulClock 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 ------------------------------------------------------- This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual core and dual graphics technology at this free one hour event hosted by HP, AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar _______________________________________________ plib-devel mailing list pli...@li... https://lists.sourceforge.net/lists/listinfo/plib-devel |