Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Nov 1995 19:22:48 +1100 (EST)
From:      Peter Marelas <maral@webnet.com.au>
To:        "Jordan K. Hubbard" <jkh@freefall.freebsd.org>
Cc:        hackers@freebsd.org
Subject:   Re: Bug in stable/-current perl?
Message-ID:  <Pine.BSF.3.91.951129192111.871B-100000@jazzy.phase-one.com.au>
In-Reply-To: <199511290543.VAA13120@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 28 Nov 1995, Jordan K. Hubbard wrote:

> jkh@freefall-> date
> Tue Nov 28 21:42:48 PST 1995
> 
> jkh@freefall-> perl -e 'printf("%02.2d\n", (localtime())[3]);'
> 28
> 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"?

10 is correct..

yeah i thought it was irish , when i came across it as well...but..

       localtime EXPR
               Converts a time as returned by the time function
               to a 9-element array with the time analyzed for
               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
				  ^^^^^
               0..6.  If EXPR is omitted, does localtime(time).

Peter




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.951129192111.871B-100000>