X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:subject:reply-to:to:references:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=V0KNzdbR95CTQTLL vx/dqh47HFdND6USGcLQSGdI1sxVV9aZDLC3e7TEvhjF46UE0W+oulMpKWnLncc/ Uu3jTNJdz6hEHlxNUuDzS8gtJ6U2F9KspTw9fCjYOVPAt0NCZ8OzQPv1dhST1Mdw WH/UPUs/VvVJqjnfTznUusZVl3Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:subject:reply-to:to:references:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=cQqo4hPVFuKUGF6YtQxi4b Fyw/o=; b=OxGtvGY5/8b1elhYReQOAwMwRIECCdyMW1i3rjr/0CZm0d1GBsTPCz /1BIltWdlTuvjN/6L+6OaSI6mGN/JPx+mAs1S8MruNba2UeK34yUwv7fUUrAgO9N RZnxwmaDAIaQhfHcNdp96rHavGVm+aI6+Mew3Dz6BiD8SNFt9RDLk= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 From: Brian Inglis Subject: Re: Bug in TIME function Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca To: cygwin AT cygwin DOT com References: <78512bbe-b912-9bf5-d6cf-9da5b982c955 AT SystematicSw DOT ab DOT ca> <016201d56a26$37271f70$a5755e50$@twcny.rr.com> Openpgp: preference=signencrypt Message-ID: Date: Mon, 16 Sep 2019 14:18:45 -0600 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 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