public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Subject: Re: Fw: [PATCH 1/2] strftime.c(__strftime): add %i, %q, %v, tests; tweak %Z docs
Date: Fri, 21 Oct 2022 14:12:43 +0200	[thread overview]
Message-ID: <Y1KMuwmuCbWQ+DN4@calimero.vinschen.de> (raw)
In-Reply-To: <24f6dd02-57a6-48c6-eb16-cc8bed524b1f@SystematicSw.ab.ca>

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.


Thanks,
Corinna


  reply	other threads:[~2022-10-21 12:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17  5:00 [PATCH 0/2] strftime.c, strptime.c: " Brian Inglis
2022-09-17  5:00 ` [PATCH 1/2] strftime.c(__strftime): " Brian Inglis
     [not found]   ` <BN2P110MB15443B0E0009D450989B3ECF9A4D9@BN2P110MB1544.NAMP110.PROD.OUTLOOK.COM>
2022-09-19 15:51     ` Fw: " C Howland
2022-09-19 23:21       ` Brian Inglis
2022-10-18 14:03       ` Corinna Vinschen
2022-10-20 22:07         ` Brian Inglis
2022-10-21 12:12           ` Corinna Vinschen [this message]
2022-10-21 20:43             ` Brian Inglis
2022-09-17  5:00 ` [PATCH 2/2] strptime.c(strptime_l): add %i, %q, %v Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y1KMuwmuCbWQ+DN4@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).