Here are excerpts from two notes from Mike Wescott (wescott@ncrcae.Columbia.NCR.COM); I'd appreciate comments on the changes Mike suggests. (Lines preceded by "> " in the second note are Mike quoting me.) --ado Date: Thu, 9 Jul 87 15:29:36 pdt Message-Id: <8707092229.AA00730@SCUBED.ARPA> Subject: Re: v08i085: Public Domain localtime We have uncovered a problem with the PD ctime with respect to the System V Verification Suite and SVID compatibility. The problem is with tzset(). Try the little program, xxx.c: #include <time.h> main() { tzset(); printf("%s\n%s\n", tzname[0], tzname[1]); } and try the following: TZ=PST8PDT ./xxx it produces: PST PWT and TZ=EST5EDT ./xxx produces EST EWT The problem is that tzname[1] become the (obsolete) EWT. The fix, I believe, would be to use the most recently used abbreviations to the value of time(0). Diff for such a fix follows and passes SVVS. -Mike Wescott wescott@ncrcae.Columbia.NCR.COM *** localtime.c.or Thu Jul 9 09:57:27 1987 --- localtime.c Thu Jul 9 14:31:38 1987 *************** *** 90,95 **** --- 90,96 ---- { register int i; register int fid; + time_t now; if (name == 0 && (name = TZDEFAULT) == 0) return -1; *************** *** 182,191 **** timezone = -s.ttis[0].tt_gmtoff; daylight = 0; #endif /* USG_COMPAT */ ! for (i = 1; i < s.typecnt; ++i) { register struct ttinfo * ttisp; ! ! ttisp = &s.ttis[i]; if (ttisp->tt_isdst) { tzname[1] = &s.chars[ttisp->tt_abbrind]; #ifdef USG_COMPAT --- 183,194 ---- timezone = -s.ttis[0].tt_gmtoff; daylight = 0; #endif /* USG_COMPAT */ ! now = time(0); ! for (i = 1; i < s.timecnt; ++i) { register struct ttinfo * ttisp; ! if (now < s.ats[i]) ! break; ! ttisp = &s.ttis[s.types[i]]; if (ttisp->tt_isdst) { tzname[1] = &s.chars[ttisp->tt_abbrind]; #ifdef USG_COMPAT ------------------------------------------------------------------------------- Date: Tue, 14 Jul 87 07:22:19 pdt Message-Id: <8707141422.AA27049@SCUBED.ARPA> Subject: Re: v08i085: Public Domain localtime
Many thanks for the note on the problem with SVVS. Would it be all right with you if I passed the note on to other interested folks?
No problem, I sent it to you with that in mind. The code could probably be made a little more efficient but it shouldn't have to run too often.
Also--the time zone files described in the "systemv" file were designed to provide System V compatibility. It looks as if you're in a position to check on whether they actually do; if you could, I'd appreciate it.
We ran SVVS (SysVr2 not r3 yet) and the only thing it complained about was the problem with the tzset() function. We are compiling with USG, USG_COMPAT, and STD_INSPIRED defined. I'll check the "systemv" file but it doesn't seem to be problem as far as SVVS goes.