Duplicated effort

Paul Eggert eggert at CS.UCLA.EDU
Tue Oct 12 04:10:05 UTC 2004

Ken Pizzini <"tz."@explicate.org> writes:

> A couple of annoying details crop up in trying to match a
> strftime() format against what the C standard says that
> asctime()'s format should be:

More generally, the standard says that strftime can assume that the
tm_* values are in "the normal range", i.e., that tm_mday, tm_hour,
etc., follow the rules of the Gregorian calendar and standard clock.
(For example, the behavior of strftime is undefined if tm_hour == 24.)
asctime is not allowed to make all these assumptions, and therefore
asctime cannot invoke a standard strftime and expect it to do the
right thing with out-of-range values.

One way out of this is to require tz's asctime to invoke tz's strftime
(rather than some generic strftime), and to extend tz's strftime to
have formats sufficient to implement tz's asctime.  I considered doing
this, but it was more work (and overall, more confusing) than simply
duplicating the 10 lines or so of code in question.

More information about the tz mailing list