Many articles said that the resolution of GetTickCount() is 55ms. It is obsolete for windows XP. We should use GetSystemTimeAdjustment() to retrieve the resolution. For Windows XP on a P4 computer, it is 15.6250 ms.
For high-resolution timer, we could use QueryPerformanceFrequency and QueryPerformanceCounter. The sample code is similar to the following:
LARGE_INTEGER Frequency; QueryPerformanceFrequency(&Frequency); LARGE_INTEGER beginPerformanceCount, endPerformanceCount; // counter value QueryPerformanceCounter(&beginPerformanceCount); // Do something QueryPerformanceCounter(&endPerformanceCount); double valinSec = (double)(endPerformanceCount.QuadPart - beginPerformanceCount.QuadPart) / (double)Frequency.QuadPart;
Its solution could be less than 1 nanosecond.