Microsoft KB Archive/115232

{|
 * width="100%"|

INFO: Timer Resolution in Windows NT and Windows 2000

 * }

Q115232

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), used with:
 * the operating system: Microsoft Windows NT, versions 3.1, 3.5, 4.0
 * the operating system: Microsoft Windows 2000

-

SUMMARY
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