delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/07/24/19:18:30

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:to:subject:mime-version:content-type
:content-transfer-encoding:date:from:in-reply-to:references
:message-id; q=dns; s=default; b=TOpQpaae+NCF4b5eEwZQk3Ws8Z2ZQ0A
8Ai5gnzwyU5EVfULcz1bONPu8iw9e89iDNetYxvy4qm1s//PMqKzgHzfZlJ/GNFh
BlGNoZxDnUCYYQ67U8egxiM6Ewp/FjCzVFHQ1Eh1bm9QdTpBkl1F8wpclsk6C92W
McCfIpOx8XDo=
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:to:subject:mime-version:content-type
:content-transfer-encoding:date:from:in-reply-to:references
:message-id; s=default; bh=F0QDqOCdWSLdJ1bbUzCnATun4Wg=; b=s8VKO
vQ0A02jdYbJWxGABXMJ9+SBozasBOovOENhQwikUtEygDe8YwgzXx/rruS2lesm1
ODxAtSoptWko7B2q/sIonFrk8DtNRYwY2PMkV2XytLcve2+TBsYocvrEP4AhPYeR
ABRlaaEhS0fB5bFIseQBwnSZnvmmT+dqZJigxc=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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.8 required=5.0 tests=AWL,BAYES_00,FROM_STARTS_WITH_NUMS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=claims, HContent-Transfer-Encoding:8bit
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=Qc8WhoTv c=1 sm=1 tr=0 a=95A0EdhkF1LMGt25d7h1IQ==:117 a=95A0EdhkF1LMGt25d7h1IQ==:17 a=IkcTkHD0fZMA:10 a=SMorJkV_YP8A:10 a=G3gG6ho9WtcA:10 a=QoqXzpLZAuxdiil9TRcA:9 a=sFIXiDdohW2_g0Q9:21 a=_FLKZjRhGh7Zihmt:21 a=QEXdDO2ut3YA:10
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin strptime() is missing "%s" which strftime() has
X-PHP-Originating-Script: 501:rcmail.php
MIME-Version: 1.0
Date: Mon, 24 Jul 2017 16:18:03 -0700
From: Kaz Kylheku <920-082-4242 AT kylheku DOT com>
In-Reply-To: <a7b1040f-baf7-cf7f-80c0-90349583ad14@Shaw.ca>
References: <BY1PR09MB0343663DE41D927E67CF0CCEA5BB0 AT BY1PR09MB0343 DOT namprd09 DOT prod DOT outlook DOT com> <2fb73f15-64b7-e10c-1e24-12ca9aa7c78b AT t-online DOT de> <a7b1040f-baf7-cf7f-80c0-90349583ad14 AT Shaw DOT ca>
Message-ID: <a4072368a580b14d68a0aa1557cc4bf6@mail.kylheku.com>
X-Sender: 920-082-4242 AT kylheku DOT com
User-Agent: Roundcube Webmail/0.9.2
X-CMAE-Envelope: MS4wfJuWsFT4hntbAgfYDvPvhOYe7dkQZMggjHCOGOop4s5x+FmHSIFhrvTc3sIewjXU17u3iNO/gO15KCBnHiUnK3RIBvYpQync4ivtG2WeWT00W02jlrMR B8h8Ag31ykJrx1D/IzBvpaxr5BA2Je4ffrGdLX1NVeqsUoBWo7i8oyku
X-IsSubscribed: yes

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.

     $ gawk 'BEGIN { print mktime("2017 07 22 12 31 55") }'
     1500751915
     $ gawk 'BEGIN { print systime() }'
     1500938050

If you can install GNU Awk on a system, chances are you can get some 
real
programming language, too, though. GNU Awk may be a little more common 
in
that if, for your given OS, a bundle of freeware exists, chances are 
good
that GNU Awk is part of its core.


--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019