Skip to main content
GameDev.net gamedev.net
🔒 Locked

time accuracy

Started by duck17 Dec 23, 2002 at 11:11 PM 5 replies 450+ views
Original Post
duck17
duck17
My question is with regard to calculating a "delta time" for my frame-rate independent animations. Currently i am using the win32 api function GetCurrentTime() and performing a difference of times to find a delta-T for my animations. My question is, is there a better api function (faster or more accurate) for finding the current time or change in time? Thanks - Duck17
duck17
duck17
i just found something in the win32 platform sdk about High-Resolution Timers, with accuracy up to 1 billionth of a second on a 1ghz cpu.

Anyone used that before or have any comments?
Antyrg
Antyrg
I prefer to use QueryPerformanceCounter instead of timeGetTime. Though I usually add a timeGetTime fallback in programs I''m going to distribute. Never know when someone''s going to be using an older computer, and I''m not sure what x86 version that started with...

And there''s also the RTDSC instruction (think that''s what it is... might be misspelled slightly, never used it)
Antyrg
Antyrg
The main reason I use them? To help track down slow code paths. FPS calculations and time scaleing aren''t the only uses for timers, and there''s no reason to have multiple types of timers just because you don''t need as fine of a resolution for some things as you do for others.
duck17
duck17
well i''d prefer better accuracy.. especially if the game is going to be multiplayer ready, i would want to make sure things are as syncronized as possible. there is enough lag already with your average internet connection. Also, i just looked at the directx8 sample source code and they all use QueryPerformanceCounter(), so i think ill go with that. Antyrg''s idea is pretty good too. I just finished reading up on the QueryPerformance functions and it wouldnt be that hard to run a check to see if its supported, and switch to an older less accurate method if needed.
But anyways, thanks for all your suggestions!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.