kre at munnari.OZ.AU
Wed Jul 28 20:13:39 UTC 2004
Date: Wed, 28 Jul 2004 07:48:44 -0700
From: Paul Eggert <eggert at CS.UCLA.EDU>
Message-ID: <87smbcyypf.fsf at penguin.cs.ucla.edu>
| That is why I'm advocating that we continue to have
| asctime always return a valid non-NULL string, even though the
| standard doesn't require this. This is a good thing -- we shouldn't
| gratuitiously break common usage even if it's no longer conforming.
I agree with that, though I suspect my interpretation of "valid"
might be different than yours. I'd prefer to always return a
string that fits exactly in a 26 byte buffer, with the \n in buf
and \0 in buf, and every other character posit position occupied
by exactly what is supposed to be there (the colons at known offsets,
etc). If that makes the output be "incorrect" when the input struct
tm contains values (way) beyond those which asctime() was designed to
handle, then that's just fine with me. Where we can handle the
value, and retain the output format, we should however.
People expecting (or who should be expecting) to deal with arbitrary
struct tm values - or in fact, just about any current code expecting
to convert times into strings ought to be using strftime, the only
code that should be using asctime() is legacy code that predates
strftime - and for that, keeping the legacy interface is important.
More information about the tz