This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Bug in TIME function
- From: Wayne Davison <wayne at opencoder dot net>
- To: cygwin <cygwin at cygwin dot com>
- Date: Fri, 13 Sep 2019 12:11:23 -0700
- Subject: Re: Bug in TIME function
- References: <78512bbe-b912-9bf5-d6cf-9da5b982c955@SystematicSw.ab.ca> <016201d56a26$37271f70$a5755e50$@twcny.rr.com>
On Fri, Sep 13, 2019 at 4:27 AM wrote:
> In Linux [times()] returns a time value and return code of 0:
The Linux man page for times() mentions this special behavior, how it
isn't portable, and even advises against using the function:
"On Linux, the buf argument can be specified as NULL, with the result
that times() just returns a function result. However, POSIX does not
specify this behavior, and most other UNIX implementations require a
non-NULL value for buf."
"[...] a portable application would be wise to avoid using this value.
To measure changes in elapsed time, use clock_gettime(2)
instead."
One might argue that it would be nice to emulate the Linux behavior,
but it's not required by POSIX.
..wayne..
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple