INFO: Timer Resolution in Windows NT and Windows 2000 |
Q115232
In Win32-based applications, the GetTickCount() timer resolution on Windows
NT, and Windows 2000 can be gotten by calling GetSystemTimeAdjustment() and checking the value returned in the lpTimeIncrement parameter. This value is indicated in 100 nanosecond units and should be divided by 10,000 to achieve a value in terms of milliseconds.
NOTE: The measurements in milliseconds indicate the period of the
interrupt, not the units of the returned value.
The GetTickCount() API should not be used for resolution critical algorythms. Instead, QueryPerformanceCounter() and QueryPerformanceFrequency() should be used.
The Win32 API QueryPerformanceCounter() returns the resolution of a high-
resolution performance counter if the hardware supports one. For x86, the
resolution is about 0.8 microseconds (0.0008 ms). You need to call
QueryPerformanceFrequency() to get the frequency of the high-resolution
performance counter.
Additional query words: 3.10 3.50
Keywords : kbAPI kbKernBase kbOSWin2000 kbDSupport kbGrpDSKernBase
Issue type : kbinfo
Technology : kbAudDeveloper kbWin32sSearch kbWin32API
|
Last Reviewed: October 27, 2000 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |