mailing list of musl libc
 help / color / mirror / code / Atom feed
* strptime.c missing timezone z case
@ 2017-04-19 14:03 Steve Coffman
  2017-04-19 16:44 ` Szabolcs Nagy
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Coffman @ 2017-04-19 14:03 UTC (permalink / raw)
  To: musl

I noticed that musl does not support timezone formats that include %z or %Z for timezone, unlike glibc.
Both %d/%b/%Y:%H:%M:%S %z and %d/%b/%Y:%H:%M:%S %Z for instance. 

When I change the timeformat to %d/%b/%Y:%H:%M:%S +0000 it works fine. Since we always use UTC, this works around the problem for us, but will affect any Alpine linux (docker) users that don't.
Looking through the musl source code to strptime.c <http://git.musl-libc.org/cgit/musl/tree/src/time/strptime.c> and strftime.c <https://github.com/BlankOn/musl/blob/master/src/time/strftime.c> I see that while strftime.c has a z case, strptime.c does not. My C is weak so that's about all I can suss out. Not sure if that's at all helpful.

More details of my investigation are here:

https://github.com/fluent/fluent-bit/issues/231


For comparison, glibc handles it this way: https://github.com/bminor/glibc/blob/master/time/strptime_l.c#L741

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: strptime.c missing timezone z case
  2017-04-19 14:03 strptime.c missing timezone z case Steve Coffman
@ 2017-04-19 16:44 ` Szabolcs Nagy
  0 siblings, 0 replies; 2+ messages in thread
From: Szabolcs Nagy @ 2017-04-19 16:44 UTC (permalink / raw)
  To: musl; +Cc: Steve Coffman

* Steve Coffman <Steve.Coffman@ithaka.org> [2017-04-19 14:03:18 +0000]:
> I noticed that musl does not support timezone formats that include %z or %Z for timezone, unlike glibc.
> Both %d/%b/%Y:%H:%M:%S %z and %d/%b/%Y:%H:%M:%S %Z for instance. 
> 

code using %z or %Z in strptime is nonconforming and thus
nonportable so it should be fixed (it will break not just
on musl).

that said it's a commonly requested feature, but the exact
requirements are not known, different implementations
handle %z differently (some support iso 8601 format only,
others support rfc822 style zone specifiers too) %Z i think
is even more inconsistent across implementations.

> When I change the timeformat to %d/%b/%Y:%H:%M:%S +0000 it works fine. Since we always use UTC, this works around the problem for us, but will affect any Alpine linux (docker) users that don't.
> Looking through the musl source code to strptime.c <http://git.musl-libc.org/cgit/musl/tree/src/time/strptime.c> and strftime.c <https://github.com/BlankOn/musl/blob/master/src/time/strftime.c> I see that while strftime.c has a z case, strptime.c does not. My C is weak so that's about all I can suss out. Not sure if that's at all helpful.
> 
> More details of my investigation are here:
> 
> https://github.com/fluent/fluent-bit/issues/231
> 
> 
> For comparison, glibc handles it this way: https://github.com/bminor/glibc/blob/master/time/strptime_l.c#L741


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-19 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 14:03 strptime.c missing timezone z case Steve Coffman
2017-04-19 16:44 ` 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).