Millisecond Timers

Started by
12 comments, last by Reverse_Gecko 21 years, 7 months ago
Let me stop this before I have to hurt someone... and trust me, I''m willing to do so.

Straight from my win32.hlp file, in the section on TimeGetTime:

quote:Note that the value returned by the timeGetTime function is a DWORD value. The return value wraps around to 0 every 2^32 milliseconds, which is about 49.71 days.This can cause problems in code that directly uses the timeGetTime return value in computations, particularly where the value is used to control code execution. You should always use the difference between two timeGetTime return values in computations.


Repeat: You should always use the difference between two timeGetTime return values in computations.

Use the difference and you''re totally fine. Also, note that GetTickCount returns a DWORD so would have the same issue - that''s why you''ll never see anything other than (NewTime - OldTime) in a tutorial on timing. Everyone uses relative timing and nobody gets hurt - right?
Advertisement
quote:Original post by Alimonster
Use the difference and you''re totally fine.
That depends. If you have a frame rate of < 1/50 days (0,00000023283064365386962890625 fps) it can be dangerous. Although, you probably have something else to worry about then
hmm... ok, well it looks like im wrong I just vaguely remember having problems with it when i first started with timing (my computers always on), but it could have been something else. I dont know.
link.

If you are using if you are using QueryPerformanceCounter()
you should cross check timeGetTime()

EDIT by ZE: fixed link, deleted redundant post.

[edited by - zealouselixir on September 11, 2002 10:47:26 PM]

This topic is closed to new replies.

Advertisement