From owner-freebsd-questions Sat Sep 23 22:24: 8 2000 Delivered-To: freebsd-questions@freebsd.org Received: from roma.coe.ufrj.br (roma.coe.ufrj.br [146.164.53.65]) by hub.freebsd.org (Postfix) with ESMTP id 8B91337B422 for ; Sat, 23 Sep 2000 22:23:57 -0700 (PDT) Received: (from uucp@localhost) by roma.coe.ufrj.br (8.9.3/8.9.3) id CAA40390 for ; Sun, 24 Sep 2000 02:23:44 -0300 (EST) (envelope-from jonny@jonny.eng.br) Received: from localhost.coe.ufrj.br(127.0.0.1), claiming to be "jonny.eng.br" via SMTP by localhost.coe.ufrj.br, id smtpdM40386; Sun Sep 24 02:23:34 2000 Message-ID: <39CD8FD9.F2B7419@jonny.eng.br> Date: Sun, 24 Sep 2000 02:23:37 -0300 From: Joao Carlos Mendes Luis Organization: Internet via Embratel X-Mailer: Mozilla 4.74 [en] (Win98; U) X-Accept-Language: pt-BR,pt,en MIME-Version: 1.0 To: questions@freebsd.org Subject: mktime(3) Y2K bug? Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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