This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in TIME function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]