[tz] strftime and nonnormalized dates/times

Steve Summit scs at eskimo.com
Thu Jul 5 14:01:47 UTC 2018


Paul wrote:
> Clive D.W. Feather wrote:
> > In this case, the resulting string could be anything but it must still
> > be a string and the call can't break anything else.
>
> ...tzcode substitutes "?" for some values out of range, e.g., month names
> when tm_mon < 0.
>
> ...The trickiest issue here is when tm_year < 1 - 1900, that is, before
> Gregorian year 1...

Thanks for the several replies.  I guess this is the best that
can reasonably be hoped for.  (I shall take care not to imagine
that the code of mine which prompted the question is strictly
conforming.)

Somehow I'd never considered %A and %B; thanks for pointing that
out.  There are occasionally implementations that try to make
various kinds of points by playing with particularly novel
interpretations of undefined or unspecified behavior (I'm pretty
sure gcc once did something particularly extreme with #pragma),
so I'm now thinking that somewhere there's a world where it might
be fun to map out-of-range tm_mon and tm_yday values to Tricember,
Pentember, Dodecahember, and Humpday, Caturday, Yesterday, etc.
(Or perhaps not.  Forget I mentioned it.  And let's not even
think about %p.)


More information about the tz mailing list