Author: Anthony Cozzie
Date: 05:27:02 10/29/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
Make sure you always use differences, so that you get the benefit of integer
overflow, e.g.
if(search_time > (zappa_get_time_ms() - start_time))
done;
zappa_u32 zappa_get_time_ms(void)
{
#ifdef WIN32
return timeGetTime(); //requires winmm.lib
#else
struct timeval start_time;
gettimeofday(&start_time, NULL);
return (zappa_u32)start_time.tv_sec * 1000 + (zappa_u32)start_time.tv_usec /
1000;
#endif
}
I'm pretty certain GetTickCount and timeGetTime() are the same internally.
anthony
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.