[tz] strftime and nonnormalized dates/times
Paul Eggert
eggert at cs.ucla.edu
Thu Jul 5 14:38:10 UTC 2018
Steve Summit wrote:
> 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
There's another point I forgot to mention, stretching things from the
application side instead of from the implementation side.
strftime is required to support dates that are not in the Gregorian calendar.
For example, a program using the Julian calendar can fill in a struct tm with
the date February 29, 1900, and strftime is obliged to process it to the
corresponding string even though this date does not exist in the Gregorian
calendar. This is well-defined in C11 and POSIX-2017. You can even process
"February 30, 1712" (a valid date in Sweden!) using strftime.
Similarly for timestamps. You can use strftime with "%H:%M:%S" to generate the
timestamp 07:32:60 if you like, even if the implementation conforms strictly to
POSIX and does not support leap seconds at all.
More information about the tz
mailing list