This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: clock_t & return -1
- From: Igor Pechtchanski <pechtcha at cs dot nyu dot edu>
- To: Alex Vinokur <alexvn at connect dot to>
- Cc: cygwin at cygwin dot com
- Date: Tue, 14 Oct 2003 14:04:39 -0400 (EDT)
- Subject: Re: clock_t & return -1
- References: <bmhbv6$fu1$1@sea.gmane.org>
- Reply-to: cygwin at cygwin dot com
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@cs.nyu.edu
ZZZzz /,`.-'`' -. ;-;;,_ igor@watson.ibm.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/