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=UQrIV3G5aG5AbtnT GYT/vfbUygmH+iIstm8DFMMPIKBuGeem681/w2FQJ6Rc69Qxnt14iCy8rzqkCPrB sADBz03/lNseLEGNAAR8AosM4IrqSQZK93ZHm+uXoue67a7n4CFOozj2C84ppi/w NBlARxiFOB2ACSIy6dDffmoBwoA= 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=8bt1zo7FrwQAyQ/n/sQjnc SdsDw=; b=clJqbffEQUlk6UTZmRA/KOX/Vzlk4Oc//bG8e4ebcdnPbzEOxb9Gcw xtFtkYKUvf7U3iwDklfVJBigeGxZO4rVmGFgdfUSNSCb52SRXmgYhl+i6+0y7UBv 8XvskS8+b1sMIz1fg/K6fKy6haJ7hdmwztfBZHOdN/MW4fKmQUseQ= 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, adequate, Kylheku X-HELO: smtp-out-so.shaw.ca X-Authority-Analysis: v=2.2 cv=Qc8WhoTv c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=IkcTkHD0fZMA:10 a=b4eMD0GmHX_ZvWjD-W0A:9 a=P_8lKrpQQP5pnoGZ:21 a=UiQ8EqXZSSLYOMdV:21 a=QEXdDO2ut3YA:10 From: Brian Inglis Subject: Re: Cygwin strptime() is missing "%s" which strftime() has Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca To: cygwin AT cygwin DOT com References: <2fb73f15-64b7-e10c-1e24-12ca9aa7c78b AT t-online DOT de> Message-ID: Date: Tue, 25 Jul 2017 10:47:23 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4wfIe3ZjVoErIqgUmkNylirwZypWkbliVs9RJ4ut4+LYVtY7Ko+y46+NHlivqaPZ6FxmCROeOULMXHEix32SuQCfQkZ3FE17u23vIXZbPBU4bfYIY7oOa7 A83eHC6GlwUDoW4nbA7Ev0h23gfnlmLcm2pAHS7apYmnu4RN704TJUFX7DixpzxVJ18bx5B10qtY6w== X-IsSubscribed: yes 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. -- 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