From owner-freebsd-hackers Wed Nov 29 14:21:32 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id OAA25936 for hackers-outgoing; Wed, 29 Nov 1995 14:21:32 -0800 Received: from ibp.ibp.fr (ibp.ibp.fr [132.227.60.30]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id OAA25909 ; Wed, 29 Nov 1995 14:21:22 -0800 Received: from blaise.ibp.fr (blaise.ibp.fr [132.227.60.1]) by ibp.ibp.fr (8.6.12/jtpda-5.0) with ESMTP id XAA05114 ; Wed, 29 Nov 1995 23:21:08 +0100 Received: from (uucp@localhost) by blaise.ibp.fr (8.6.12/jtpda-5.0) with UUCP id XAA17135 ; Wed, 29 Nov 1995 23:21:07 +0100 Received: (from roberto@localhost) by keltia.freenix.fr (8.7.1/keltia-uucp-2.6) id WAA03724; Wed, 29 Nov 1995 22:28:02 +0100 (MET) From: Ollivier Robert Message-Id: <199511292128.WAA03724@keltia.freenix.fr> Subject: Re: Bug in stable/-current perl? To: jkh@freefall.freebsd.org (Jordan K. Hubbard) Date: Wed, 29 Nov 1995 22:28:02 +0100 (MET) Cc: hackers@freefall.freebsd.org In-Reply-To: <199511290543.VAA13120@freefall.freebsd.org> from "Jordan K. Hubbard" at Nov 28, 95 09:43:31 pm X-Operating-System: FreeBSD 2.2-CURRENT ctm#1378 X-Mailer: ELM [version 2.4 PL24 ME8b] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG Precedence: bulk It seems that Jordan K. Hubbard said: > jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[4]);' > 10 > jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[5]);' > 95 > > 10? Am I misunderstanding something fundamental about perl's > localtime() call, or should this be an "11"? You're missing the fact that $mon (the fifth parameter) is 0-based per the man page: the local timezone. Typically used as follows: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); All array elements are numeric, and come straight out of a struct tm. In particular this means that $mon has the range 0..11 and $wday has the range So 10 == 11 :-) -- Ollivier ROBERT -=- The daemon is FREE! -=- roberto@keltia.frmug.fr.net FreeBSD keltia.freenix.fr 2.2-CURRENT #7: Mon Nov 6 21:08:06 MET 1995