RE: [Plib-devel] [BUG] Minor bug in ulClock
Brought to you by:
sjbaker
From: Fay J. F C. AAC/W. <joh...@eg...> - 2005-07-14 17:06:50
|
Joerg, Thank you very much for spotting that. I am putting the fix into CVS. I also set "now" to zero seconds in reset(), making it consistently "seconds since reset" instead of starting out being "seconds since epoch" and then changing. Folks, Is there a reason we shouldn't set "delta" in "reset()" to 0.0000001 (its minimum value in update() ) rather than 1.0 / 30.0 ? I value the consistency, which I would consider a good enough reason to change it. John F. Fay Technical Fellow, Jacobs/Sverdrup TEAS Group 850-729-6330 joh...@eg... -----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 |