Subject: B20.1 clock() function bug?
From: [email-masked] (Brian P Kasper)

29 Jan 1999 23:09:09 -0800
Message-ID: <040C736B1E5D205D*/c=us/admd=0/prmd=aero/o=notes/s=Kasper/g=Brian/i=P/.cygnus.gnu-win32@MHS>
To: [email-masked]

I'm getting different answers from the clock() function
under Cygwin B20.1 and Microsoft Visual C++ 6.0.

I'm using the clock() function and the CLOCKS_PER_SEC
#define to time the execution of some code.  I'm also comparing
the run time with the real world using a stopwatch.

If I run the program for 10 seconds by my stopwatch, the Visual C++
version of the code reports that 10 seconds have passed.  If I
run the Cygwin version for 10 seconds, the program reports that
only 6 seconds have passed.

My understanding is that clock() reports the number of system
clock ticks which have passed since the program started executing.
According to the the VC++ documentation,

  The clock function,s era begins (with a value of 0) when the
  C program starts to execute.
  It returns times measured in 1/CLOCKS_PER_SEC (which
  equals 1/1000 for Microsoft C).

Am I misinterpreting the behavior of clock()?  Does it return
user time instead of absolute system time?  If it's not something
like this, I think there might be a bug in the implementation.

FWIW, I searched the mailing list archives and found no references to
possible bugs in clock().

-Brian
 [email-masked]
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".