From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: Bug in TIME function
Date: Wed, 18 Sep 2019 00:16:00 -0000 [thread overview]
Message-ID: <cf21ee36-25de-47e7-ac0e-4dbe2e878975@SystematicSw.ab.ca> (raw)
In-Reply-To: <c128e605c925ed0704409d917c1b7f25@mail.kylheku.com>
On 2019-09-13 16:14, Kaz Kylheku wrote:
> On 2019-09-13 12:11, Wayne Davison wrote:
>> 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."
>
> Ah, so it is a documented extension in Linux, after all. In that case,
> Cygwin should support it.
>
>> One might argue that it would be nice to emulate the Linux behavior,
>> but it's not required by POSIX.
>
> Cygwin's explicit motto is "Get that Linux feeling --- on Windows";
> and a tiny part of the Linux feeling is that times(NULL) works.
For functions returning data, -1/EFAULT should be considered a feature, except
if you only want some approximation of elapsed wall clock time from an arbitrary
epoch, which may overflow or change any time, and for which there are functions
better suited with differing resolutions.
For me, that return value is about the same as Cygwin uptime and net stats
workstation:
$ uptime
14:10:56 up 68 days, 1:54, 3 users, load average: 1.17, 1.12, 1.11
$ net stats workstation
"Workstation Statistics for \\...
Statistics since 2019-07-10 12:18:35
..."
which is a couple of minutes less than:
$ wmic os get LastBootUpTime
LastBootUpTime
20190710121614.432467-360
and the return value from clock_gettime(CLOCK_BOOTTIME,...).
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
--
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
next prev parent reply other threads:[~2019-09-16 20:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 18:16 tlake
2019-09-12 18:44 ` Kaz Kylheku
2019-09-13 0:50 ` Kaz Kylheku
2019-09-12 23:03 ` Brian Inglis
2019-09-13 11:37 ` tlake
2019-09-13 19:59 ` Wayne Davison
2019-09-13 23:05 ` Kaz Kylheku
2019-09-18 0:16 ` Brian Inglis [this message]
2019-09-16 7:30 ` Achim Gratz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cf21ee36-25de-47e7-ac0e-4dbe2e878975@SystematicSw.ab.ca \
--to=brian.inglis@systematicsw.ab.ca \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).