delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/10/14/14:05:01

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Tue, 14 Oct 2003 14:04:39 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Alex Vinokur <alexvn AT connect DOT to>
cc: cygwin AT cygwin DOT com
Subject: Re: clock_t & return -1
In-Reply-To: <bmhbv6$fu1$1@sea.gmane.org>
Message-ID: <Pine.GSO.4.56.0310141356340.20462@slinky.cs.nyu.edu>
References: <bmhbv6$fu1$1 AT sea DOT gmane DOT org>
Importance: Normal
MIME-Version: 1.0

On Tue, 14 Oct 2003, Alex Vinokur wrote:

> # ------ man clock (fragments) ------
> # RETURNS
> #        The amount of processor time used so far by your program, in units
> #        defined by the machine-dependent macro `CLOCKS_PER_SEC'.
> #        If no measurement is available, the result is `-1'.
>
> So, clock() is unsigned and never returns -1 (?!)
>
> If one must write
>   ----------------------------------
>   if (!(clock () == (clock_t)(-1)));
>   ----------------------------------
>   I think it is worth noting that in the manual.

The above is always good practice anyway.  Besides, it seems they do it
this way in a few other places as well:

<http://www.hmug.org/man/3/clock.html>
<http://www.rocketaware.com/man/man3/clock.3.htm>
<http://developer.apple.com/documentation/Darwin/Reference/ManPages/html/clock.3.html>
<http://www-sbras.nsc.ru/cgi-bin/www/unix_help/unix-man?clock+3>
<http://pluto.iis.nsk.su/cgi-bin/man-cgi?clock+3>

IOW, this is not Cygwin specific.  FWIW, you're welcome to submit a patch
to the cygwin-doc package.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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