Author: Lex Loep
Date: 22:25:11 01/13/00
Go up one level in this thread
On January 13, 2000 at 19:01:08, Tom Kerrigan wrote:
>On January 13, 2000 at 18:48:55, Christophe Theron wrote:
>
>>Check this again Tom. Lex (author of Rebel-Tiger GUI) told me the same some time
>>ago. We both checked and realized that GetTickCount() has the same ~50ms
>>accuracy under Windows 95/98.
>
>No, I'm quite sure of this.
>
>I use GetTickCount() to compute how fast my program solves test suite problems
>(among other things). Here are my solution times from the first few WAC
>problems:
>
>0.869
>(didn't solve)
>0.021
>0.010
>0.012
>0.019
>0.021
>0.039
>0.013
>0.017
>
>So it seems to me that GetTickCount() is usually accurate to the millisecond.
>
>It would be trivial to write a program to verify this fact, to be 100% sure.
>
>-Tom
// ticktest.cpp : Defines the entry point for the console application.
//
Try this:
#include "stdafx.h"
int main(int argc, char* argv[])
{
DWORD t1,t2;
printf("Tick test!\n");
for(int i=0; i<5; i++)
{
Sleep(0);
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_TIME_CRITICAL);
t1=GetTickCount();
while((t2=GetTickCount())==t1);
SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_NORMAL);
printf("Tdiff=%d\n",t2-t1);
}
return 0;
}
Under W95 resulst are random, under NT diff between two measurement is 10 ms
For accurate measurement of small times use QueryPerformanceCounter and
QueryPerformanceFrequency
Lex
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.