Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: clock() function in c++

Author: Daniel Clausen

Date: 15:23:38 10/28/03

Go up one level in this thread


On October 28, 2003 at 18:16:23, macaroni wrote:

>I have been using the clock() c++ function in my timeout function. However, I
>have noticed that occasionally my program doesn't think for nearly as long as it
>should, and moves even before it has a legal ply 1 move to play. I have narrowed
>it down to the timeout function, but can't understand why it doesn't work...does
>the clock() function ever 'turnover' and go back to 0, if so, how frequently?
>could this be the cause of the problem, and if so, what can I do about it?
>cheers

Two remarks:

(1)
At least under Linux, clock() returns the time (or clocks) the processor was
used.  If the machine is under heavy load, this might not be the real time that
passed.

(2)
The UNIX-manpage has the following section:

   Note  that  the  time  can  wrap  around.   On  a  32bit  system  where
   CLOCKS_PER_SEC  equals 1000000 this function will return the same value
   approximately every 72 minutes.


If that's the same in Windows, that may explain what you observe?

HTH

Sargon



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.