From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70098 invoked by alias); 25 Jul 2017 16:47:29 -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 70066 invoked by uid 89); 25 Jul 2017 16:47:29 -0000 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 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; Tue, 25 Jul 2017 16:47:26 +0000 Received: from [192.168.1.100] ([24.64.240.204]) by shaw.ca with SMTP id a2zTd8bMrMaqMa2zUd1t9v; Tue, 25 Jul 2017 10:47:25 -0600 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.Inglis@SystematicSw.ab.ca To: cygwin@cygwin.com References: <2fb73f15-64b7-e10c-1e24-12ca9aa7c78b@t-online.de> Message-ID: Date: Tue, 25 Jul 2017 18:27:00 -0000 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 X-SW-Source: 2017-07/txt/msg00359.txt.bz2 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@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