Olson, Arthur David (NIH/NCI) olsona at
Thu Jul 22 14:30:47 UTC 2004

Code in "asctime" such as...

		long	y;

		y = timeptr->tm_year + (long) TM_YEAR_BASE;
		if (y >= -999 && y <= 9999)
			(void) sprintf(buf, "%.3s %.3s%3d %02d:%02d:%02d
				wn, mn,
				timeptr->tm_mday, timeptr->tm_hour,
				timeptr->tm_min, timeptr->tm_sec,
		else	(void) sprintf(buf, "%.3s %.3s%3d %ld\n",
				wn, mn, timeptr->tm_mday, y);

...never returns NULL and never (when applied to a "struct tm" derived from
a 64-bit time_t) overflows a 26-character buffer passed to asctime.
It does lose time-of-day information in the distant past and distant future.


More information about the tz mailing list