Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Nov 1995 01:15:16 +0100 (MET)
From:      J Wunsch <j@uriah.heep.sax.de>
To:        jkh@freefall.freebsd.org (Jordan K. Hubbard)
Cc:        hackers@freefall.freebsd.org
Subject:   Re: Bug in stable/-current perl?
Message-ID:  <199511300015.BAA16347@uriah.heep.sax.de>
In-Reply-To: <199511290543.VAA13120@freefall.freebsd.org> from "Jordan K. Hubbard" at Nov 28, 95 09:43:31 pm

next in thread | previous in thread | raw e-mail | index | archive | help
As 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"?

j@uriah 199% man 3 localtime

CTIME(3)                   UNIX Programmer's Manual                   CTIME(3)

NAME
     asctime, ctime, difftime, gmtime, localtime, mktime - transform binary
     date and time value to ASCII
...
     External declarations as well as the tm structure definition are in the
     <time.h> include file.  The tm structure includes at least the following
     fields:

           int tm_sec;     /* seconds (0 - 60) */
           int tm_min;     /* minutes (0 - 59) */
           int tm_hour;    /* hours (0 - 23) */
           int tm_mday;    /* day of month (1 - 31) */
           int tm_mon;     /* month of year (0 - 11) */
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
           int tm_year;    /* year - 1900 */
           int tm_wday;    /* day of week (Sunday = 0) */
           int tm_yday;    /* day of year (0 - 365) */
           int tm_isdst;   /* is summer time in effect? */
           char *tm_zone;  /* abbreviation of timezone name */
           long tm_gmtoff; /* offset from UTC in seconds */

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199511300015.BAA16347>