From owner-freebsd-questions Sun Sep 24 3:13:57 2000 Delivered-To: freebsd-questions@freebsd.org Received: from srcso.globis.ru (globis.ru [212.248.80.7]) by hub.freebsd.org (Postfix) with ESMTP id E971A37B43C for ; Sun, 24 Sep 2000 03:13:45 -0700 (PDT) Received: from raduga.dyndns.org (raduga.sochi.net [212.248.82.76]) by srcso.globis.ru (8.9.3/8.9.3) with ESMTP id OAA07650 for ; Sun, 24 Sep 2000 14:31:18 +0400 (MSD) (envelope-from igor@raduga.dyndns.org) Received: (from igor@localhost) by raduga.dyndns.org (8.10.0/8.10.0) id e8OADQL06599 for freebsd-questions@freebsd.org; Sun, 24 Sep 2000 14:13:26 +0400 Date: Sun, 24 Sep 2000 14:13:26 +0400 From: Igor Roboul To: FreeBSD questions Subject: Re: mktime(3) Y2K bug? Message-ID: <20000924141326.A6548@linux.rainbow> Reply-To: igorr@crosswinds.net Mail-Followup-To: FreeBSD questions References: <39CD8FD9.F2B7419@jonny.eng.br> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre4i In-Reply-To: <39CD8FD9.F2B7419@jonny.eng.br>; from jonny@jonny.eng.br on Sun, Sep 24, 2000 at 02:23:37AM -0300 X-Operating-System: Linux linux.rainbow 2.2.14-plus-SMP X-Best-Window-Manager: Window Maker (www.windowmaker.org) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I think you have incorrectly configured your system. On my system (out-of-box): main() { struct tm tm; time_t t; bzero( &tm, sizeof tm ); tm.tm_sec = 0; tm.tm_min = 1; tm.tm_hour = 0; tm.tm_mday = 1; tm.tm_mon = 9; tm.tm_year = 100; tm.tm_isdst = -1; t = mktime( &tm ); printf( "t = %ld\n", t ); printf( "%s", ctime( &t ) ); } %cc t.c %./a.out t = 970344060 Sun Oct 1 00:01:00 2000 %uname -a FreeBSD darkstar 4.1-STABLE FreeBSD 4.1-STABLE #0: Sat Sep 23 01:23:21 MSD 2000 root@darkstar:/usr/obj/usr/src/sys/DARKSTAR i386 % On Sun, Sep 24, 2000 at 02:23:37AM -0300, Joao Carlos Mendes Luis wrote: > Hi, > > Try the following piece of code: > > #include > > main() > { > struct tm tm; > time_t t; > > bzero( &tm, sizeof tm ); > tm.tm_sec = 0; > tm.tm_min = 1; > tm.tm_hour = 0; > tm.tm_mday = 1; > tm.tm_mon = 9; > tm.tm_year = 100; > tm.tm_isdst = -1; > > t = mktime( &tm ); > printf( "t = %ld\n", t ); > printf( "%s", ctime( &t ) ); > } > > > My results: > > FreeBSD: > > t = -1 > Wed Dec 31 20:59:59 1969 > > Solaris: > > t = 970369260 > Sun Oct 1 00:01:00 2000 > > Linux: > > t = -1 > Wed Dec 31 20:59:59 1969 > > If I change tm_year to 99, everything is ok. > > Is this a bug, or just something stupid I can?t see at 2am without > enough coffe? > > I found this executing at(1) as "at 10/01/00", if that matters. > > TIA, > > Jonny > > -- > Jo?o Carlos Mendes Lu?s jonny@embratel.net.br > Networking Engineer jonny@jonny.eng.br > Internet via Embratel jcml@ieee.org > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga", Sochi, Russia http://www.brainbench.com/transcript.jsp?pid=304744 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message