#include #include "debug.h" // this tests the // // - how often GetTickCount takes steps > 2 // - how accurate Sleep() is // measured using GetTickCount // measured using QueryPerformanceCounter // - how accurate WaitForSingleObject() timeout is // measured using GetTickCount // measured using QueryPerformanceCounter int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { DebugSetLogfile("tstclock.log"); #define CLEANTICKS 65536 #define SLEEPTICKS 1024 #define SLEEPLOOPS 16 int i,j; DWORD *v= (DWORD*)LocalAlloc(LPTR, (CLEANTICKS+2*SLEEPTICKS*SLEEPLOOPS)*sizeof(DWORD)); DWORD *p= v; DWORD t= GetTickCount(); DWORD s; i=0; while (i<5) { s= GetTickCount(); if (s-t>2) { debug("%d\n", s-t); i++; t=GetTickCount(); } } *p++= 0; for (i=1 ; i