public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: newlib@sourceware.org
Subject: Re: Cygwin strptime() is missing "%s" which strftime() has
Date: Tue, 25 Jul 2017 09:19:00 -0000	[thread overview]
Message-ID: <20170725091905.GC14419@calimero.vinschen.de> (raw)
In-Reply-To: <8d88e863-e8c2-bed4-1b73-3f4a977c15d8@LGSInnovations.com>

[-- Attachment #1: Type: text/plain, Size: 3239 bytes --]

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 into an
> > > > > integer, 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.
> > > > > Also, strptime() was designed to be a reversal to strftime() (from 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 following also
> > > > > does not work even from command line:
> > > > > 
> > > > > $ 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 submit a git
> > > > format-patch.
> > > Approach looks good, so please send the patch to the newlib mailing list
> > > 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.
> > 
> > > 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 further
> > > ado and you skip the part where you have to send the patch twice :)
> > Darn, originated on cygwin list, forwarded to cygwin-patches, forgot this should
> > have gone to newlib list.
> > 
> > > 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, compilers, and
> > style, so made some changes, attached another diff for discussion, before
> > submitting a patch.
> > Let me know if you want conditionals or declarations changed, hoisted to
> > function start, case braces removed, other issues?
> > 
> 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, even
> 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 ¯\_(ツ)_/¯


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2017-07-25  9:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <BY1PR09MB0343663DE41D927E67CF0CCEA5BB0@BY1PR09MB0343.namprd09.prod.outlook.com>
     [not found] ` <acc19ec5-055b-1bd4-997d-a247755163bf@SystematicSw.ab.ca>
2017-07-24 20:42   ` Brian Inglis
2017-07-24 21:36     ` Craig Howland
2017-07-24 23:04       ` Brian Inglis
2017-07-25  9:19       ` Corinna Vinschen [this message]
2017-07-25  9:16     ` Corinna Vinschen
2017-07-25 16:47       ` Brian Inglis
2017-07-25 17:38         ` Craig Howland
2017-07-25 18:52         ` Corinna Vinschen
2017-07-25 20:13           ` Brian Inglis
2017-07-26 10:49             ` Corinna Vinschen
2017-07-26 17:27               ` Brian Inglis
2017-07-26 19:34                 ` Corinna Vinschen
2017-07-28 20:50                   ` Brian Inglis
2017-07-31  9:55                     ` Corinna Vinschen
2017-08-18 18:53                       ` Corinna Vinschen
2017-08-18 19:38                         ` Brian Inglis
2017-08-18 19:38                       ` Brian Inglis
2017-08-18 20:01                       ` Brian Inglis
2017-08-19 14:01                       ` Brian Inglis
2017-08-21  3:09                         ` Brian Inglis
2017-08-21  9:10                           ` Corinna Vinschen
2017-08-24  2:14                             ` [PATCH] newlib/libc/time/strptime.c(strptime_l) add strptime %F %s Brian Inglis
2017-08-24  8:50                               ` Corinna Vinschen
2017-08-25  5:30                                 ` Brian Inglis
2017-08-25 12:06                                   ` Corinna Vinschen

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=20170725091905.GC14419@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).