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

timeGetTime() VS GetTickCount()

Started by Rob Loach Dec 3, 2002 at 2:45 AM 1 replies 10.5k views
Original Post
Rob Loach
Rob Loach
I was looking through some APIs and noticed these two. They both do the same thing, but which one is "better" to use? Please give your prefrences and reasons. Regards, - Rob Loach OverTech Technologies ----------- "Life moves pretty fast. If you don''t stop and look around once in awhile, you could miss it." - Ferris Bueller
Rob Loach [Website] [Projects] [
Bad_Maniac
Bad_Maniac
TimeGetTime() is portable on all platforms, standard in C(++?)
whereas GetTickCount() is M$ only. but they do the exact same thing.
Atleast that''s the only difference I know of. Did I miss something?
Don't we all still remember and miss the day we plotted our first pixel?
niyaw
niyaw
a couple of things.

first, timeGetTime is a win32 function, not a c one.

second, timeGetTime is much more accurate than GetTickCount (1 ms vs 50 ms resolution).

third, GetTickCount takes less time to execute.

fourth, nice use of the $. (stolen from Stoffel)

use GetTickCount if 50 ms resolution is acceptable because it has less overhead, and timeGetTime if you need more precise timing. remember to call timeBeginPeriod and timeEndPeriod to obtain 1 ms resolution on nt.

example: timeGetTime is a better choice if you want to calculate fps for your game, and GetTickCount will be better if you want to drop inactive clients from your game after let's say one minute timeout.

[edited by - niyaw on December 3, 2002 5:13:38 AM]

Topic Locked

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

Sign in to reply to this topic.