Author: Tom Kerrigan
Date: 10:35:33 08/08/00
Go up one level in this thread
On August 08, 2000 at 05:19:39, Alexander Kure wrote:
>Hi James,
>
>#include <time.h>
>
>clock_t start = clock();
>
>// do what ever you want to measure
>
>clock_t stop = clock() - start;
>
>printf("Elapsed time in seconds: %.2f", (double) stop / CLOCKS_PER_SEC");
>
>Function clock() returns the number of clock ticks of elapsed processor time for
>the current process.
In Paderborn 1995 I got bitten by clock(). For some stupid reason,
CLOCKS_PER_SEC on a Sparc is 1000000, even though it's only accurate to the
second. Anyway, that means there's an integer overflow after your program has
been running for 70 minutes. Which meant that my chess program lost track of
time and basically hung.
So I'd be wary of using clock() again. :)
-Tom
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.