Klemens Nanni wrote:
> I came across this thanks to a nicely detailed bug report about
> mail/isync's `CopyArrivalDate' feature, which uses strptime(3).  Quote:
> 
>       The IMAP protocol specifies a date format beginning with a
>       day-of-month space-padded to two characters. The %d specifier in
>       glibc's strptime(3) will consume a space-padded day of month,
>       but OpenBSD's %d only accepts leading zeroes.

> I've checked various implementations with regard to differences between
> both conversion specifiers:
> 
> glibc         %d same as %e[0], both allow multiple leading spaces[1]
> musl          %d same as %e[2], no spaces allowed[3]
> Illumos               %d same as %e[4], both allow one leading space
> FreeBSD               %d other than %e[5], %e allows one leading space[6]

There is also posix.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/strptime.html

d
The day of the month [01,31]; leading zeros shall be permitted but shall not
be required.
e
Equivalent to %d.

However, later it adds:
Several "equivalent to" formats and the special processing of white-space
characters are provided in order to ease the use of identical format strings
for strftime() and strptime().

I think this sounds like a reasonable change, but austin bugs may be another
place to bring it up. They maybe intended for %e to consume a space, but my
reading of the text is that they forgot to actually say so.

I do believe it should be possible to round trip data through these functions
with the same format string.

Reply via email to