Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: *WEIRD* MVSC 6.0 behavior. I think I got it

Author: Dann Corbit

Date: 14:41:26 04/18/01

Go up one level in this thread


On April 18, 2001 at 17:21:46, Dan Newman wrote:
[snip]
>clock() is supposed to return the cpu time consumed by the calling
>process.  IIRC, the MS version of clock() just returns wall-clock time
>--but that might have been corrected by now.  (Actually, what you
>want for chess *is* a wall-clock timer...)  Another problem clock()
>has is that it has a very low resolution (1/18.2 of a second, IIRC).
>
>I used to use clock(), but more recently I've been using a Windows API
>call, QueryPerformanceCounter(), which gives a much higher resolution.
>Its resolution depends on the hardware involved--it can be sub-
>microsecond.  The documentation implies that the hardware timer on
>which it depends isn't available on all systems, so it might not work
>yours--but I'd be surprised if it didn't.  You use another function,
>QueryPerformanceFrequency(), to find out if the timer exists and what
>its resolution is.

You can inquire first to see if it works on your system, and then use something
else if it is absent.  That is the approach that I use.



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.