Artifacts Associated With Ticket 218769
Ticket change [9c0bea9e78] (rid 111216) by nobody on 2000-10-26 01:05:09:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 2066 Bug Version: 8.1 SubmitDate: '1999-05-14' LastModified: '1999-07-01' Severity: MED Status: Released Submitter: pat ChangedBy: foster OS: Solaris Machine: Other FixedDate: '1999-05-19' FixedInVersion: 8.2b1 ClosedDate: '2000-10-25' Name: Isaac Hollander Comments: This is a crucial Y2K issue. Scriptics's Y2K statement discusses the 2 digit year issue in great details, but does not address proper leap year handling. ReproducibleScript: This is already reported as bugID 1985, but I can't figure out how to update an existing bug. Please close out bugID 1985 and use this bug report. The leap year handling in the Convert() routine in generic/tclDate.c is incorrect. Leap years are divisible by 4, unless it's divisible by 100, in which case it's a leap year only if it's divisible by 400. Hence 2000 is a leap year, but 2100 is not. The code is incorrect in all versions of tcl I've looked at from 8.0p2 through the latest code in CVS. Patch: $ diff -c tclDate.c tclDate.c.orig *** tclDate.c Thu May 6 17:32:51 1999 --- tclDate.c.orig Mon Feb 10 13:03:15 1997 *************** *** 430,439 **** Julian += DaysInMonth[i]; if (Year >= EPOCH) { for (i = EPOCH; i < Year; i++) ! Julian += 365 + ( (i % 4 == 0) && ((i % 100 != 0) || (i % 400 == 0 )) ); } else { for (i = Year; i < EPOCH; i++) ! Julian -= 365 + ( (i % 4 == 0) && ((i % 100 != 0) || (i % 400 == 0 )) ); } Julian *= SECSPERDAY; Julian += TclDateTimezone * 60L; --- 430,439 ---- Julian += DaysInMonth[i]; if (Year >= EPOCH) { for (i = EPOCH; i < Year; i++) ! Julian += 365 + (i % 4 == 0); } else { for (i = Year; i < EPOCH; i++) ! Julian -= 365 + (i % 4 == 0); } Julian *= SECSPERDAY; Julian += TclDateTimezone * 60L; $ PatchFiles: generic/tclDate.c This patch is good and needs to be applied. However, to avoid any confusion this is not a Y2K issue. Things will work fine for dates around 2000. In fact, the nearest dates this will be a problem are 1900 and 2100 (which are not even in the UNIX epoch!). None the less, this is a bug and should be fixed. 05/14/1999 10:00 - rjohnson - Applied the patch. It's probably not going to be an issue, but it won't hurt to play it a little safer. 05/14/1999 10:30 - redman - -- 05/17/1999 hershey - foundin initialized to: "obsolete: 8.1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "incorrect leap year handling in generic/tclDate.c"
- type initialized to: "Bug"
Ticket change [3041ce4ca3] (rid 93216) by welch on 2000-10-26 08:28:14:
- closedate changed to: "2000-10-26T01:28:14"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [8a94ac2414] (rid 127416) by dgp on 2001-04-18 07:08:41:
- closedate changed to: "2001-04-18T00:08:41"
- closer changed to: "dgp"
- subsystem changed to: "06. Time Measurement"