Author: Robert Hyatt
Date: 09:36:45 05/31/98
Go up one level in this thread
On May 31, 1998 at 12:13:28, Jens Baek Nielsen wrote:
>
>My chessprogram Dabbaba uses this code to get the time:
>
>double get_the_time()
>// returns the number of 1/100 seconds since the program started
>{return (double)(100*(clock())/CLK_TCK);}
>
>It works fine except at midnight, where strange numbers suddenly appears
>- suddenly white has used more than 8 million seconds etc.!
>
>Is it only me who has encountered this problem?
>Is there a better way to measure the time?
>
>I consider to estimate the time from the number of nodes searched at
>this midnightevent, but it is rather silly code to have in your program.
>
>I use a Borland Turbo C++ 3.0 compiler.
>
>Greetings Jens
somebody has a bug. clock() has *nothing* to do with real time... it
is supposed to return the cpu time used by the running process, which
means that midnight is meaningless. If you use a real clock call, such
as gettimeofday(), then you do have to correct at midnight, *if* your
function simply returns the time in 24-hour format. For unix, we
ignore it since the time is returned relative to 1970.
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.