ITimer returning incorrect value

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
Gatekeeper
Posts: 31
Joined: Fri Apr 21, 2006 12:00 am
Location: Australia

ITimer returning incorrect value

Post 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.
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Hm, strange.
Gatekeeper
Posts: 31
Joined: Fri Apr 21, 2006 12:00 am
Location: Australia

Post 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.
Post Reply