Computer Chess Club Archives


Search

Terms

Messages

Subject: More

Author: James Swafford

Date: 20:02:46 02/16/06

Go up one level in this thread


On February 16, 2006 at 22:20:20, James Swafford wrote:

Seems the system clock under Linux is running at double time too. :)
I know it was correct earlier, now it's 45 minutes fast.

:-/

--
James


>While testing Prophet on my wife's new AMD64 I noticed test suites
>finished too fast.  Using either the MilliTimer() or gettime()
>methods below, the program finishes in about 5 seconds, when it
>should take 10.
>
>Anyone know why, or what I can do to fix this?  Since I'm only using
>this machine for CCT, I could hack up a kludge, but I'm more
>interested in the cause.
>
>I'm using Gentoo Linux 2.6.15 for AMD64.
>--
>James
>
>
>#include <stdlib.h>
>#include <stdio.h>
>#include <sys/time.h>
>#include <sys/timeb.h>
>
>int MilliTimer(void)
>{
>   struct timeb t;
>   ftime(&t);
>   return (t.time*1000)+t.millitm;
>}
>
>int gettime(void)
>{
>   timeval te;
>   gettimeofday(&te,NULL);
>   int t = te.tv_sec;
>   return t * 1000 + te.tv_usec/1000;
>}
>
>int main() {
>   int start_time = gettime();
>   printf("start: %d\n",start_time);
>   while (gettime() - start_time < 10000);
>
>   printf("end: %d\n",gettime());
>   return 0;
>}



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.