From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 81071 invoked by alias); 25 Jul 2017 09:19:10 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 80546 invoked by uid 89); 25 Jul 2017 09:19:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*f:sk:8d88e86, H*i:sk:8d88e86, game, his X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Jul 2017 09:19:07 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B77D080F63 for ; Tue, 25 Jul 2017 09:19:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B77D080F63 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=vinschen@redhat.com Received: from calimero.vinschen.de (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F2EE6DA82 for ; Tue, 25 Jul 2017 09:19:06 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id C23E0A80422; Tue, 25 Jul 2017 11:19:05 +0200 (CEST) Date: Tue, 25 Jul 2017 09:19:00 -0000 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: Cygwin strptime() is missing "%s" which strftime() has Message-ID: <20170725091905.GC14419@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <851e9a02-f7c2-25c4-f37d-64d17d5c6d54@SystematicSw.ab.ca> <8d88e863-e8c2-bed4-1b73-3f4a977c15d8@LGSInnovations.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sHrvAb52M6C8blB9" Content-Disposition: inline In-Reply-To: <8d88e863-e8c2-bed4-1b73-3f4a977c15d8@LGSInnovations.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-SW-Source: 2017/txt/msg00638.txt.bz2 --sHrvAb52M6C8blB9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 3241 On Jul 24 17:36, Craig Howland wrote: > On 07/24/2017 04:41 PM, Brian Inglis wrote: > > On Mon, 24 Jul 2017 02:32:14 -0700, Corinna Vinschen wrote:> On Jul 23 = 22:07, > > Brian Inglis wrote: > > > > On 2017-07-23 20:09, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: > > > > > > But that's just scanning a decimal integer to time_t. > > > > > It's not a question of whether I can or can't convert a string in= to an > > > > > integer, rather it's a question about portability of code that us= es %s for > > > > > both functions and expects it to work unchanged in the Cygwin env= ironment. > > > > > Also, strptime() was designed to be a reversal to strftime() (fro= m the > > > > > man-pages: the strptime() function is the converse function to > > > > > strftime(3)) so both are supposed to "understand" the same basic = set of > > > > > formats. Because of Cygwin's strptime() missing "%s", the follow= ing also > > > > > does not work even from command line: > > > > >=20 > > > > > $ date +"%s" | strptime "%s" > > > > Attached diff for proposed strptime %s and %F support. > > > > Let me know if you would prefer a different approach before I submi= t a git > > > > format-patch. > > > Approach looks good, so please send the patch to the newlib mailing l= ist > > > with a nice log message. > > Thinking just "add strptime %F %s support"; involved because I use date= and > > dateutils a lot in shell scripts; also hope this will also allow %F %s = support > > in dateutils strptime, which the OP just added to his cygwin posts. > >=20 > > > In fact, just send patches like these immediately in the right format= to > > > the right list. Chances are good that the patch is taken without fur= ther > > > ado and you skip the part where you have to send the patch twice :) > > Darn, originated on cygwin list, forwarded to cygwin-patches, forgot th= is should > > have gone to newlib list. > >=20 > > > In this case I have a nit, but this should be discussed on the right > > > mailing list so all affected parties can chime in. Hint: strtoimax is > > > not available on all platforms yet (patches still in limbo)... > > Figured there would need to be some tweaks for newlib platforms, compil= ers, and > > style, so made some changes, attached another diff for discussion, befo= re > > submitting a patch. > > Let me know if you want conditionals or declarations changed, hoisted to > > function start, case braces removed, other issues? > >=20 > Neither %F nor %s are defined for strptime() in POSIX, so they should not= be > expected to be portable. (See > http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html) = For > that matter, %s is not defined for strftime(), either in POSIX or C99, ev= en > though it is in Newlib. If either of these are added, they should have > gates (or at the very least, comments) to show they are extensions. (They > appear to be GLIBC extensions, based on comments in the man page from a > GLIBC-based system.) Right, in theory. Just a bit late in the game I guess. We already support %u, %V, %Z unconditionally. I checked the FreeBSD code and they don't even bother to add comments =C2=AF\_(=E3=83=84)_/=C2=AF Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --sHrvAb52M6C8blB9 Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZdw0JAAoJEPU2Bp2uRE+gUvAP/0EXOOeljeCNhz4AIGBibH8J BYl2nRS0IyrT/PScrI7nW/jDMuBDCKnMEzeCk+fLdKkgzmdBrcNSUcNHU7C9aD8S WJ9TQqQXNvNWI8BKgJVsPhC3ALm4uc5Bz5VfhqHWpejdI8qkX9rhhVgNARYZLQNE W4oIQWv02b+pD4O/YN7o/yoEXCu6YTJ4b5L0i1VDxE6OCURRP/r1cqWI3UPnDNOk D0zOeQTKIBIwFppzYilD0BA7muD8uzrzqkhJXr2QKmG6dj6wJzgMoQxadfM74tHX IFejEJzNx6J8auBk/QaOkkVGJdwvhhmPOk2nJpXC/Vhl+dyXn70CWMgCs2feJJB1 5F27/iunthJucJd2wkvZ/dmC8QST3ETCtBSPdbzPsqdaATaN/U/shU88KPedsS2V e7tt8BnllyykTQ5XP0R3F4ygUT+y1BlTD6Vc6xjEJpzFHv6aiVRTPzntBytp2Anm VUwBKTxoFkWeYrViHv+7ynihmEkldiVA/LuKJ4U1dm849zR61epdkfvL8l0F6a7X 2VWtvYWt5FlMlU87lWSOTtDXyA7r0Qw+qYODqpxI0YmMJlZU9oeH4VtsJKJOyDCN ojVnycKWKKIfWGDWYa5bgHphWrVJ4Wn07scBj1BZo8t8w8toBsC15vxDKQx7eaAu 1JQSYDGPOg6JNQDYnXvO =sPfp -----END PGP SIGNATURE----- --sHrvAb52M6C8blB9--