From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94693 invoked by alias); 16 Sep 2019 20:18:50 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 94680 invoked by uid 89); 16 Sep 2019 20:18:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=Take, disturbing, H*R:D*ca X-HELO: smtp-out-so.shaw.ca Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.139) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Sep 2019 20:18:48 +0000 Received: from [192.168.1.114] ([24.64.172.44]) by shaw.ca with ESMTP id 9xSPiCBmKSrVc9xSQisMrd; Mon, 16 Sep 2019 14:18:47 -0600 From: Brian Inglis Subject: Re: Bug in TIME function Reply-To: Brian.Inglis@SystematicSw.ab.ca To: cygwin@cygwin.com References: <78512bbe-b912-9bf5-d6cf-9da5b982c955@SystematicSw.ab.ca> <016201d56a26$37271f70$a5755e50$@twcny.rr.com> Openpgp: preference=signencrypt Message-ID: Date: Wed, 18 Sep 2019 00:16:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00185.txt.bz2 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