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:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=uOP92KWhSruhdOAN 9Ox/TZtR29WUfBO5jekxGMVUqjBKCtdZAwOFOQQ256ZZjUS+fnLTkcUxrDckUGXg Ew6HgK8WmnTMuNuCAj6OagLbKMAhX4dA/9v7+w2AlqhIqHGpTWh2UxQKWC8q/Mak SsN+Lt3/6JiFwc1dbqSDnBKEGkU= 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:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=dNnV9u/mUt4ElZlD+gyrjN 0CGOY=; b=yW4zadFeUkZGh+OTH9+A+yXDZ/UWHBe+zhGpKWm3eKSPipWOmNZbn8 Zpi5OOyduWE+UL3sUwkWzIYccmaELEYR9UQByrN9J1CPBDFPN6qZYiec28KnLF2A pSr2EWSCZQizpSLDlb+JVrWCLbaB8M1TwpiXTwuRV4b2zCco2BF3M= 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-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=gps, GPS, Julian, julian X-HELO: smtp-out-no.shaw.ca X-Authority-Analysis: v=2.2 cv=a+JAzQaF c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=IkcTkHD0fZMA:10 a=wn2tWnfOKRrLvmu7J_sA:9 a=sg9TXPkArZuDwlEG:21 a=PJ_N2y8x0Rc4rN6b:21 a=QEXdDO2ut3YA:10 Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: Cygwin strptime() is missing "%s" which strftime() has To: cygwin AT cygwin DOT com References: <2fb73f15-64b7-e10c-1e24-12ca9aa7c78b AT t-online DOT de> From: Brian Inglis Message-ID: <61717e28-cfcb-ca9d-a20d-eb54c31a3c4a@SystematicSw.ab.ca> Date: Tue, 29 Aug 2017 18:25:08 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfIISWYxe3YbXcF2pTw9g9W81dcZv1HtkKTTfRQ314w8eEUTesfcSVWC4pS41xrxi7RVufY5FYDBImSCylZKvMJsK9LXH2OHYL08cjMiq0dEMUACPiDZi W8sqq7AGyuwmyfeTRDNxEY9f6BG9zqQKg5vsjxFP3qyi58DYTk0g8Uxkgj3WCHEfiLk2TrL5bO2raw== X-IsSubscribed: yes On 2017-07-25 10:47, Brian Inglis wrote: > On 2017-07-24 17:18, Kaz Kylheku wrote: >> On 24.07.2017 15:51, Brian Inglis wrote: >>> On 2017-07-24 15:02, Hans-Bernhard Bröker wrote: >>>> Am 24.07.2017 um 04:09 schrieb Lavrentiev, Anton (NIH/NLM/NCBI) [C]: >>>> >>>>> rather it's a question about portability of code that >>>>> uses %s for both functions and expects it to work unchanged in the >>>>> Cygwin environment. >>>> >>>> And the answer to that question is: such code _is_not_portable_, and therefore >>>> that expectation is wrong. >>>> >>>> If that code claims to be portable, then its use of %s in either of those >>>> functions constitutes a _bug_. >>>> >>>> In the old days there was a well-known fallacy known by the slogan "all the >>>> world's a VAX." Nowadays it appears to have been replaced by an equally >>>> wide-spread, and equally incorrect belief that all the world is Linux. Well, >>>> it's not. Not even the whole Un*x world is Linux. >>> >>> Rather "all the world's a GNU" i.e. glibc, but there's also BSD libc, RTEMS and >>> Cygwin newlib, and others. >> >> Since the utilities depend on the C library functionality for strptime and >> strftime, even having GNU utilities won't help. >> >> There doesn't appear any nice way in POSIX shell scripting to have access to >> the seconds since the Epoch. >> >> If you have GNU Awk, it has some time functions like mktime, which don't rely >> on any C library extensions. > > If you have GNU gawk you probably also have GNU coreutils date, which supports > +%s for output and -d AT nnnnnnnnnn for input, whether or not the system strftime > and strptime support %s. > > GNU coreutils date with shell arithmetic is adequate to support shell script > conversions between time scales with different epochs e.g. Julian Day, Modified > Julian Day, NTP, Unix, GPS, and calculations using those values. > > Awk, JS, or some other language supporting FP is required for subsecond or > fractional day accuracy with convenient output. Patch in latest test release provides %s support for strptime(3) used by strptime(1). Another strptime(3) patch was just submitted to fix %F handling. More newlib time patches coming to fix handling years around INT_MAX and high values of time_t. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada -- 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