Page 1 of 1

ITimer returning incorrect value

Posted: Sun Jul 02, 2006 3:11 am
by Gatekeeper
Hi,
I found this bug last night while I was mucking around. To me it definitely seems like a bug. Somebody correct me if I'm wrong.

Basically, I found that ITimer->getRealTime() sometimes returns a slighltly incorrect value. Here was what I was doing:

Code: Select all

u32 starttime = Timer->getRealTime();

//blah blah blah

u32 currenttime = Timer->getRealTime();
u32 deltatime = currenttime - starttime;
Well, if the code between starttime and currenttime took less than 1msec, sometimes I was getting a value for starttime being larger than currenttime (by 1 or 2 msecs).

For me it was an easy fix - I just checked if starttime was larger than current time, and if it was I set deltatime to zero.

Posted: Sun Jul 02, 2006 9:08 am
by niko
Hm, strange.

Posted: Sun Jul 02, 2006 9:24 pm
by vitek

Posted: Wed Jul 05, 2006 2:35 am
by Gatekeeper
I don't use a dual core processor or a dual CPU machine... I use an AMD 64 3200+, running on 32bit WindowsXP.