Author: Dieter Buerssner
Date: 13:58:07 05/13/04
Go up one level in this thread
On May 13, 2004 at 16:35:59, Jeff GAZET wrote:
>More details about this code :
>
>int start_time, int stop_time;
>init_time=3600; // for example
>start_time=get_ms(); // get_ms() returns int
Which Compiler/OS? I don't know the get_ms() function. Windows has a
GetTickCount function, that returns uptime in milliseconds as a DWORD (32 bit
unsigned long). It will wrap over after about 50 days. But using unsigned
arithmetic, this will not be a problem, if you don't want to set the search time
for over 50 days.
You must reverse the logic a bit, however, to avoid a bug, that will be seen
after 50 days uptime.
DWORD start_time, stop_time, interval;
interval = 3600*1000;
start_time=GetTickCount();
do {
/* things */
} while (GetTickCount()-start_time < interval);
Note, that his will take care of the wrap around.
>There was a bug for a fiew minutes, can you believe that ?
Yes, that is sort of funny.
Regards,
Dieter
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.