Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: chess time and midnight

Author: Roberto Waldteufel

Date: 00:15:59 07/24/98

Go up one level in this thread



On July 24, 1998 at 00:41:13, Inmann Werner wrote:

>Hello
>
>At midnight the clock of my program gets corrupted. I think there was some
>messages some times ago here in CCC, but I do not find them.
>Has anybody found something out about it? (Strange thing)
>
>Werner

Hi Werner,

Yes, I discovered this problem some time back. I have also noticed it in a
number of other chess programs, eg Dabbaba will keep on calculating forever if
midnight passes during its search. The problem occurs because system clock
counts the seconds past midnight, and resets to zero at midnight, so when you
calculate elapsed time=TIMER - Starttime you get a huge negative answer. There
is a simple remedy. When you calculate elapsed time, test it to see if you get a
large negative value, say <1000. Don't test for <0, because for very short times
less than about .05 seconds, the resolution error may give you a very small
negative value for elapsed time instead of zero. If you find elapsed time is
negative by a large amount, just add 60 x 60 x 24 (the number of seconds in a
day) to your elapsed time to correct it. I implemented this some while back now,
and I can report that itworks fine.

Best wishes,
Roberto



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.