Duplicated effort
Ken Pizzini
tz. at explicate.org
Tue Oct 12 01:30:46 UTC 2004
On Mon, Oct 11, 2004 at 03:19:44PM -0400, Olson, Arthur David (NIH/NCI) wrote:
> I'm thinking that a way to reduce the amount of coding to take care of
> wide-ranging tm_year values is to have asctime rely on strftime to get a
> correct year string.
> Can anyone else think of problems with this approach?
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:
1. The standard says asctime()'s day-of-month should be "%3d".
For in-range values this can be a strftime " %e", but for
out-of-range values there's not a good alternative.
2. The standard uses "%d" for the year, but "%Y" zero-pads
when the field width would otherwise be shorter than
4 characters.
--Ken Pizzini
More information about the tz
mailing list