* strptime problems
@ 2014-05-08 4:32 Rich Felker
2014-05-08 13:44 ` Isaac Dunham
2014-05-08 16:42 ` Szabolcs Nagy
0 siblings, 2 replies; 3+ messages in thread
From: Rich Felker @ 2014-05-08 4:32 UTC (permalink / raw)
To: musl
It was raised somewhere (on IRC, I think) that strptime still has some
failure paths where functionality is unimplemented. These should have
been caught and fixed a long time ago, but they weren't, so I'd like
to get it done now. However I'm not clear on what the behavior of
strptime should be when reading "derived" fields that don't actually
correspond to anything in the "struct tm". Should it just parse and
ignore them, or should it somehow convert back? The week-based-year
stuff is probably the biggest question but there are others too.
Rich
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strptime problems
2014-05-08 4:32 strptime problems Rich Felker
@ 2014-05-08 13:44 ` Isaac Dunham
2014-05-08 16:42 ` Szabolcs Nagy
1 sibling, 0 replies; 3+ messages in thread
From: Isaac Dunham @ 2014-05-08 13:44 UTC (permalink / raw)
To: musl
On Thu, May 08, 2014 at 12:32:14AM -0400, Rich Felker wrote:
> It was raised somewhere (on IRC, I think) that strptime still has some
> failure paths where functionality is unimplemented. These should have
> been caught and fixed a long time ago, but they weren't, so I'd like
> to get it done now. However I'm not clear on what the behavior of
> strptime should be when reading "derived" fields that don't actually
> correspond to anything in the "struct tm". Should it just parse and
> ignore them, or should it somehow convert back? The week-based-year
> stuff is probably the biggest question but there are others too.
I'd say it shouuld convert back.
"%U %w %Y" is enough information to find the day referred to.
HTH,
Isaac Dunham
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: strptime problems
2014-05-08 4:32 strptime problems Rich Felker
2014-05-08 13:44 ` Isaac Dunham
@ 2014-05-08 16:42 ` Szabolcs Nagy
1 sibling, 0 replies; 3+ messages in thread
From: Szabolcs Nagy @ 2014-05-08 16:42 UTC (permalink / raw)
To: musl
* Rich Felker <dalias@libc.org> [2014-05-08 00:32:14 -0400]:
> to get it done now. However I'm not clear on what the behavior of
> strptime should be when reading "derived" fields that don't actually
> correspond to anything in the "struct tm". Should it just parse and
> ignore them, or should it somehow convert back? The week-based-year
> stuff is probably the biggest question but there are others too.
strptime seems to be underspecified, it's not clear what happens
in case of inconsistent input, what tm_* fields should be filled
out, etc
glibc sets tm.tm_wday when it can be calculated, musl doesn't
glibc sets __tm_gmtoff so strptime depends on the current tz setting
glibc supports %s in strptime (non-posix), musl doesn't
in musl invalid format strings don't fail now
in the numeric_range logic i think a <= can be changed into <
--- a/src/time/strptime.c
+++ b/src/time/strptime.c
@@ -138,10 +138,12 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri
case '%':
if (*s++ != '%') return 0;
break;
+ default:
+ return 0;
numeric_range:
if (!isdigit(*s)) return 0;
*dest = 0;
- for (i=1; i<=min+range && isdigit(*s); i*=10)
+ for (i=1; i<min+range && isdigit(*s); i*=10)
*dest = *dest * 10 + *s++ - '0';
if (*dest - min >= (unsigned)range) return 0;
*dest -= adj;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-08 16:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-08 4:32 strptime problems Rich Felker
2014-05-08 13:44 ` Isaac Dunham
2014-05-08 16:42 ` Szabolcs Nagy
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).