From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35642 invoked by alias); 26 Jul 2017 10:49:23 -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 35080 invoked by uid 89); 26 Jul 2017 10:49:22 -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=Hx-languages-length:2125, global_locale, STC, H*i:sk:9c38bce 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; Wed, 26 Jul 2017 10:49:21 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DAC7CC04D2A8 for ; Wed, 26 Jul 2017 10:49:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DAC7CC04D2A8 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.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 8255F6061E for ; Wed, 26 Jul 2017 10:49:19 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id C29BAA80446; Wed, 26 Jul 2017 12:49:18 +0200 (CEST) Date: Wed, 26 Jul 2017 10:49:00 -0000 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: Cygwin strptime() is missing "%s" which strftime() has Message-ID: <20170726104918.GF14419@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <851e9a02-f7c2-25c4-f37d-64d17d5c6d54@SystematicSw.ab.ca> <20170725091613.GB14419@calimero.vinschen.de> <20170725185206.GE14419@calimero.vinschen.de> <9c38bcee-fbb0-9a30-0c28-58629f54aa0e@SystematicSw.ab.ca> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6Vw0j8UKbyX0bfpA" Content-Disposition: inline In-Reply-To: <9c38bcee-fbb0-9a30-0c28-58629f54aa0e@SystematicSw.ab.ca> User-Agent: Mutt/1.8.3 (2017-05-23) X-SW-Source: 2017/txt/msg00646.txt.bz2 --6Vw0j8UKbyX0bfpA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2153 On Jul 25 14:13, Brian Inglis wrote: > On 2017-07-25 12:52, Corinna Vinschen wrote: > > On Jul 25 10:47, Brian Inglis wrote: > >> On 2017-07-25 03:16, Corinna Vinschen wrote: > >>> [...] > >>> I don't think we need to use intmax_t at all here. Checking for > >>> LLONG_MAX should be sufficient. However, this is strptime_l. so you > >>> should use strtoll_l/strtol_l, just like the rest of the function. > >>> > >>> On second thought, do we have to do this at all? Our time_t is always > >>> long anyway so using just strtol_l and checking for ERANGE should be > >>> sufficient: > >>> > >>> int old_errno =3D _REENT->_errno; > >>> sec =3D strtol_l (buf, &s, 10); > >>> int new_errno =3D _REENT->_errno; > >>> _REENT->_errno =3D old_errno; > >>> if (s =3D=3D buf || new_errno =3D=3D ERANGE || etc... > >>> > >>>> + BIG_T sec; > >>>> + time_t t; > >>>> + > >>>> + sec =3D STRTOBIG (buf, &s, 10); > >>>> + t =3D (time_t)sec; > >>>> + if (s =3D=3D buf > >>>> + || (BIG_T)t !=3D sec > >>>> + || localtime_r (&t, timeptr) !=3D timeptr) > >> > >> Is time_t always long on all newlib platforms, or could it be long > >> long in some environments/memory models e.g. Windows 64 VS/MinGW > >> LLP64/IL32P64 vs Cygwin/Unix LP64/I32LP64? Could/should we keep the > >> strtol[l] options and use the ..._l variants? > >=20 > > Well... on *third* thought, targets may redefine time_t via redefining > > _TIME_T_. Targets not doing that will get long, so yeah, you're right. > > Maybe it is safer to use always strtoll_l and just break this down to > > time_t on the way. >=20 > My concern has always been do all newlib RTEMS targets support long > long, even if same as long, and stroll_l? Yes. The long long functions are not excluded like we do with long double stuff. > Trying to build standalone or combined STC for this with changed strptime= .c > ld/collect2 fails to resolve ...global_locale. Yeah, it's an internal function to newlib. You need to include libc/locale/setlocale.h somehow to accomplish that. STC from Cygwin userspace will do. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer Red Hat --6Vw0j8UKbyX0bfpA Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZeHOuAAoJEPU2Bp2uRE+gwb4P/Ap97ePM5+fAVxePxDPq4Ngc AdLtZsDrijmwM83cCyHMaZ1h1nrWXO/GDvG9L2Wq+kq5uEyJep3lbzVcx/vg3dST 2F5G117Yb87QDeuImtcfnzTIRpLLx0a4IJLoAnUU6GLgWHZMstEHSQV53LrdCXSN BWBztNlonWVoTodvJDLQtX3jTCtl4gjf1StnQ7oneINEKi5uWKKQu2zABzjCVwzH i9CKca1ZTjP0Fu431HRb09Z0eHwpVzZ4AY0190BJYs1LB0ZILC57ox+N32CY7Aml a3iie98TvdBCdqG/rEB4q04Wa6+LHPa8kerPKMQ8dqbcfMH1++yRwtTfPYERKCz4 w+Dza7Y0vSQX271MgJvfRo3p6ltllHwncFCgynQsJd7rv55tFhoRuuHFp5WnLCAI pIebxeEMpMmUohWJUj5ncBgjA6/Qa4hXqhuvp6atdItY3CFBG48HhlOo7OeK9uWr QbaYzHS22qSjE4Ukh+gbVMAbsGy62X3l3U1hdr0HbBSscWVDUgV3LBZXXa5con0i IcD/C0je2h+lTm6/5Xj8K44xJCw1KbIAeOjOoQOiScK+0gx2pCpaHSTsN7Clgaoc 2OhjCqYv/s8nkOuGNHrEHG58cH7bKa2zDyEpdcBh1UgmjvRoIifvgRG2bDmhn2Yo J4P6kR65BTuV1nuMnzfU =qwzq -----END PGP SIGNATURE----- --6Vw0j8UKbyX0bfpA--