Talk:GetTickCount

From Wikipedia, the free encyclopedia

[edit] Resolution Issues

It has been documented (link) that GetTickCount() is limited to the resolution of the system clock, being updated once per clock interrupt and is therefore not sufficiently reliable for purposes of measuring the exact number of millisecons elapsed between two events. This has been brought up a number of times in various programming circles (sorry, I don't have any citations available) and an alternative has been proposed: QueryPerformanceCounter (link).

QueryPerformanceCounter, on systems that support it, returns values with much greater accuracy and precision than GetTickCount. However, QueryPerformanceCounter takes longer to execute because it communicates directly with the system timing hardware. When used with QueryPerformanceFrequency (link), which varies from system to system, programs can translate returned values into a number of milliseconds and with enough accuracy to satisfy delicate timing needs.

For example, on Windows XP systems I've tested, GetTickCount will only increment every 15 or 16 milliseconds, which renders its usefulness in the order of about a 60th of a second, not a 1000th of a second. This is especially apparent in graphics applications running at 75fps. I think it would be a good idea to make a note of GetTickCount's resolution quirk in the article somewhere. //07:35, 24 February 2008 12.214.116.18

Good point and I agree. I have also been noticing this behavior, and GetTickCount is not suitable for high precision time measuring. CooPs89 (talk)