Below might be a simpler asctime.c fix. --ado ------- asctime.c ------- *** /tmp/geta7409 Thu Oct 14 17:29:28 2004 --- /tmp/getb7409 Thu Oct 14 17:29:28 2004 *************** *** 5,11 **** #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)asctime.c 7.26"; #endif /* !defined NOID */ #endif /* !defined lint */ --- 5,11 ---- #ifndef lint #ifndef NOID ! static char elsieid[] = "@(#)asctime.c 7.27"; #endif /* !defined NOID */ #endif /* !defined lint */ *************** *** 83,89 **** --- 83,96 ---- if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR) mn = "???"; else mn = mon_name[timeptr->tm_mon]; + #if STRICTLY_STANDARD_ASCTIME /* + ** Be strict, potential overflow problems included. + ** In an ideal world, this code is never going to be used. + */ + (void) sprintf(year, "%d", timeptr->tm_year + TM_YEAR_BASE); + #else /* !STRICTLY_STANDARD_ASCTIME */ + /* ** Use strftime's %Y to generate the year, to avoid overflow problems ** when computing timeptr->tm_year + TM_YEAR_BASE. ** Assume that strftime is unaffected by other out-of-range members *************** *** 90,95 **** --- 97,103 ---- ** (e.g., timeptr->tm_mday) when processing "%Y". */ (void) strftime(year, sizeof year, "%Y", timeptr); + #endif /* !STRICTLY_STANDARD_ASCTIME */ /* ** We avoid using snprintf since it's not available on all systems. */