Addition to Arthur Olsen/4.3bsd table-driven ctime

Arthur David Olson ado at elsie.UUCP
Wed Apr 1 23:28:21 UTC 1987


> While working over ctime, I came up with a couple of questions:
> 
> 	In asctime, shouldn't the year really be printed with %4d
> 	(or maybe %-4d) so that the returned string is guaranteed
> 	to have its advertised 26-character length?  (I realize
> 	that the code is lifted directly from the X3J11 draft
> 	standard, and that %d will only get it wrong for dates in
> 	the middle ages that a 32-bit time_t can't begin to reach.
> 	On the other hand, asctime gets handed a broken-down tm
> 	struct, so early years are quite possible.)
> 
> 	Shouldn't the offtime() routine be declared static?
> 	It's not a publicized interface.
> 
> 					   Steve Summit
> 					   stevesu at copper.tek.com

Even %4d won't guarantee the advertised 26-character length if tm_year
is big (or small) enough (for example, 10000); bogus tm_wday and tm_mon
values can cause problems as well.  You may want to send a note to an
X3J11 committee member.

offtime was declared static in the mod.sources posting unless
STD_INSPIRED was defined.  Its eventual fate lies more in the hands of
standards committees and other folks wiser than yours truly at this point.

				--ado



More information about the tz mailing list