From owner-freebsd-hackers Mon Aug 17 08:36:13 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id IAA15830 for freebsd-hackers-outgoing; Mon, 17 Aug 1998 08:36:13 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from ics.com (ics.com [140.186.40.192]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA15779 for ; Mon, 17 Aug 1998 08:35:55 -0700 (PDT) (envelope-from kaleb@ics.com) Received: from ics.com (kaleb@teapot.ics.com [140.186.40.160]) by ics.com (8.9.0.Beta5/8.9.0.Beta5) with ESMTP id LAA07823 Mon, 17 Aug 1998 11:30:31 -0400 (EDT) Message-ID: <35D84C94.635DDD5E@ics.com> Date: Mon, 17 Aug 1998 15:30:28 +0000 From: "Kaleb S. KEITHLEY" Organization: Integrated Computer Solutions X-Mailer: Mozilla 4.5b1 [en] (X11; I; Linux 2.0.31 i586) X-Accept-Language: en MIME-Version: 1.0 To: hackers@FreeBSD.ORG Subject: WRT y2k compliance, in 2000, the day after Feb 28 is NOT Feb 29. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG All this talk about y2k stuff, consider the following: #include #include #include #include int main () { time_t feb28; /* 28 Feb, 2000, 23:59:59 */ time_t mar1; struct tm tm_feb28; /* 28 Feb, 2000, 23:59:59 */ struct tm* tm_mar1; /* 1 Mar, 2000, 00:00:00 */ tm_feb28.tm_sec = tm_feb28.tm_min = 59; tm_feb28.tm_hour = 23; tm_feb28.tm_mday = 28; tm_feb28.tm_mon = 1; tm_feb28.tm_year = 100; tm_feb28.tm_isdst = -1; /* for POSIX mktime to DTRT WRT DST */ feb28 = mktime (&tm_feb28); (void) printf ("%s\n", ctime (&feb28)); mar1 = feb28 + 1; (void) printf ("%s\n", ctime (&mar1)); tm_mar1 = gmtime (&mar1); (void) printf ("month (s/b 2):%d\n", tm_mar1->tm_mon); (void) printf (" day (s/b 1):%d\n", tm_mar1->tm_mday); return 0; } I ran this program on: SunOS 4.1.4, Solaris 2.5.1 Solaris 2.6 HPUX 10.20 IRIX 5.3 IRIX 6.2 Digital Unix 3.2 Redhat Linux 5.0 (libc6/glibc 2.0.7) and they all got it wrong. (It could be that one or more of them are fixed in some patch I don't have installed. ) I didn't try on FreeBSD because that's at home, but I'd be willing to wager serious money that it gets it wrong too. And I didn't check, but if they all think 2000 has a 29 Feb., then I'd wager they think that there's 366 days in the year too, and that all the day-of-the-week are off by a day for every day after Feb 28. /usr/bin/cal is broken too on the two systems I checked. -- Kaleb S. KEITHLEY To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message