delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/01/30/08:52:59

From: N8TM AT aol DOT com
Subject: Re: B20.1 clock() function bug?
30 Jan 1999 08:52:59 -0800 :
Message-ID: <22156dfd.36b31927.cygnus.gnu-win32@aol.com>
Mime-Version: 1.0
To: Brian DOT P DOT Kasper AT notes DOT aero DOT org, gnu-win32 AT cygnus DOT com

In a message dated 1/30/99 1:28:38 AM Pacific Standard Time,
Brian DOT P DOT Kasper AT notes DOT aero DOT org writes:

<<   The clock function,s era begins (with a value of 0) when the
   C program starts to execute.>>

I don't think you can count on that.  It should return a value of type
clock_t, which overflows and starts over periodically.

<<   It returns times measured in 1/CLOCKS_PER_SEC (which
   equals 1/1000 for Microsoft C).>>

Always use the local CLOCK_T.  Who knows when it might change or when you
might use a different brand of software.
 
<< Am I misinterpreting the behavior of clock()?  Does it return
 user time instead of absolute system time? >>

Read your C textbook.  That's what it should do, at least on NT.  On W95, this
is not possible, and maybe M$ has set up the NT version for compatibility with
W95.  BTW, the last time I checked clock() (prior to B20.1) it didn't work on
W95, so you have to use something based on QueryPerformance calls.  I'll look
into this.

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

I'm no archives expert, but I do recall discussing this, although the focus
was on the g77 version.

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019