From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta001.cacentral1.a.cloudfilter.net (omta001.cacentral1.a.cloudfilter.net [3.97.99.32]) by sourceware.org (Postfix) with ESMTPS id 590FA3A5264B for ; Fri, 21 Oct 2022 20:44:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 590FA3A5264B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=systematicsw.ab.ca Received: from shw-obgw-4001a.ext.cloudfilter.net ([10.228.9.142]) by cmsmtp with ESMTP id lg6zoM1tmS8WrlyrxoKZNf; Fri, 21 Oct 2022 20:43:53 +0000 Received: from [10.0.0.5] ([184.64.124.72]) by cmsmtp with ESMTP id lyrwo7PNrkTFZlyrwovqRL; Fri, 21 Oct 2022 20:43:52 +0000 X-Authority-Analysis: v=2.4 cv=D8dUl9dj c=1 sm=1 tr=0 ts=63530489 a=oHm12aVswOWz6TMtn9zYKg==:117 a=oHm12aVswOWz6TMtn9zYKg==:17 a=IkcTkHD0fZMA:10 a=CCpqsmhAAAAA:8 a=BCVRRYYnAAAA:8 a=mDV3o1hIAAAA:8 a=Jf-ifddT4M-wZvFCHBAA:9 a=QEXdDO2ut3YA:10 a=ul9cdbp4aOFLsgKbc677:22 a=Yfo1nd69h7ycsZ8reatu:22 a=_FVE-zBwftR9WsbkzFJk:22 Message-ID: Date: Fri, 21 Oct 2022 14:43:52 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.3 Reply-To: newlib@sourceware.org Subject: Re: Fw: [PATCH 1/2] strftime.c(__strftime): add %i, %q, %v, tests; tweak %Z docs Content-Language: en-CA To: newlib@sourceware.org References: <20220917050005.5758-1-Brian.Inglis@SystematicSW.ab.ca> <20220917050005.5758-2-Brian.Inglis@SystematicSW.ab.ca> <24f6dd02-57a6-48c6-eb16-cc8bed524b1f@SystematicSw.ab.ca> From: Brian Inglis Organization: Systematic Software In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfKK3iUI/b+RvqZFdGRnox0qGytiJjHSqDh1xaQH7+K4CZNW0fUivQIY8b3RAOcPcKEJWvc4nPqRXjdFwRqexwQX2T/9Q+auzjurYq/Uj8t/OcsO+bxVv LaO1X5YLQ5pSktQHo0Zee4XqJSVzXC4nmb4+mT/ciFewP4bvkEnVrOIQjaT4LWWiOqLgfSrxahPP4D77hAkbLqPbBUKx0AEuFSM= X-Spam-Status: No, score=-1163.7 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2022-10-21 06:12, Corinna Vinschen wrote: > On Oct 20 16:07, Brian Inglis wrote: >> On 2022-10-18 08:03, Corinna Vinschen wrote: >>> On Sep 19 11:51, C Howland wrote: >>>> On Saturday, September 17, 2022 1:00 AM, Brian Inglis wrote: >>>>> newlib/libc/time/strftime.c(__strftime): >>>>> %i year in century [00..99] Synonym for "%y". Non-POSIX extension. >>>>> [tm_year] >>>>> %q GNU quarter of the year (from `<<1>>' to `<<4>>') [tm_mon] >>>>> %v OSX/Ruby VMS/Oracle date "%d-%b-%Y". Non-POSIX extension. [tm_mday, >>>>> tm_mon, tm_year] >>>>> add %i %q %v tests >>>>> %Z clarify current time zone *abbreviation* not "name" [tm_isdst] >>>>> --- >>>>> newlib/libc/time/strftime.c | 67 +++++++++++++++++++++++++++++++++++-- >>>>> 1 file changed, 64 insertions(+), 3 deletions(-) >> >>> - %i: Where is used and documented? I don't see this in glibc, not even >>> in the latest from the glibc git repo. >> >> Some portable language implementations for non-Unix platforms that I came >> across and documented but did not keep track of, and now can't find! > > So we don't have that in either BSD, nor GNU, nor POSIX, but only > in other non-POSIX platforms. Hmm. Along these lines, we could also > make a case for supporting Microsoft's %I64 printf format and I'm > not so hot on that... > > For the time being, please let's drop %i. Defining it now may result in > accidental collisions with the POSIX standard, should it get extended. > >>> - %q: Ditto. For a GNU extension, it's surprisingly absent from the >>> most recent glibc code, or do I miss something? >> >> Looks like this may have been lost in the discussion: >> >> https://inbox.sourceware.org/libc-alpha/2f5f737e-2e42-08c6-ae2b-33aab798a1d9@draigBrady.com/ >> >> but as he says, it was already in gnulib, and made it into date the same month: >> >> https://git.savannah.gnu.org/cgit/coreutils.git/diff/?id=30012b290facf66551cdf395ace397903d00483d > > Ok, that's fine then. > >>> - %v: OSX/Ruby? Isn't that already gone? Also, it introduces another >>> ambiguous date format where %F or equivalent should be used instead. >> >> All the BSDs, Darwin, Oracle, and Ruby support it: it is localized, but not >> ambiguous, as it's dd-Mon-yyyy. > > I found it in all three BSDs with a comment > > /* > ** From Arnold Robbins' strftime version 3.0: > ** "date as dd-bbb-YYYY" > ** (ado, 1993-05-24) > */ > > Also, it's defined as a recursion with the format "%e-%b-%Y", > unconditionally (no padding, etc). Maybe we should replicate that > verbatim (including the comment) to keep in line with BSD. > > Also, the BSDs do *not* define %v in strptime, so I think we shouldn't > do this either. It may accidentally collide with a standards extension, > just as %i. Consensus seems to be that, as it's been claimed by BSDs, it may be standardized or will have to be avoided: but no problem with your decision to drop from strptime. Noticed "%+" in man-pages-linux and BSD strftime(3) defined as default locale (C/POSIX) date(1) format like as/ctime with %Z - "%a %b %e %T %Z %Y". Presumably added so that the previous default locale output could easily be provided for backward compatibility once %c %x %X could be localized. Should I also add this to our newlib strftime patch? Are there pointers to that default locale and "%c" format in newlib and Cygwin? I will search and check but could miss something defined away in the wild. Presumably I should also drop %i and %v from Cygwin strptime.cc patch on cygwin-patches? -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry