From: Craig Howland <howland@LGSInnovations.com>
To: <newlib@sourceware.org>
Subject: Re: Cygwin strptime() is missing "%s" which strftime() has
Date: Tue, 25 Jul 2017 17:38:00 -0000 [thread overview]
Message-ID: <37908e9e-d806-af06-4d24-9b00d3878080@LGSInnovations.com> (raw)
In-Reply-To: <bfb34bf5-e73c-2d38-b3e1-afa215f947e6@Shaw.ca>
On 07/25/2017 12:47 PM, Brian Inglis wrote:
> Don't we need to save and zero errno to distinguish a new error, and restore if
> it stays zero, rather than just pick up the current value, and assume if it
> is/was ERANGE it's bad?
Yes, it needs to be set to 0 before calling strtol_l.
POSIX does not define any errors for strptime(). Therefore by general
rule it is permitted for it to set errno to be non-0. However, it is just as
easy to always restore it instead of checking for non-0 (why add the check?).
Always restoring also indirectly conveys the intent that strptime() is not
required to set errno, that no errors are defined for it.
On 07/25/2017 05:19 AM, Corinna Vinschen wrote:
>> 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 ¯\_(ã)_/¯
Not having done it right earlier is not a good reason to not do it better going
forward. That said, OK, no compile-time gate since the other things are
hard-coded, but let's at least have comments that they are extensions:
+ case 'F' : /* %Y-%m-%d (GNU extension) */
+ case 's' : { /* (GNU extension) */
Craig
next prev parent reply other threads:[~2017-07-25 17:38 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
2017-07-25 9:16 ` Corinna Vinschen
2017-07-25 16:47 ` Brian Inglis
2017-07-25 17:38 ` Craig Howland [this message]
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=37908e9e-d806-af06-4d24-9b00d3878080@LGSInnovations.com \
--to=howland@lgsinnovations.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).