Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Mar 2002 13:46:27 -0800
From:      "Crist J. Clark" <cjc@FreeBSD.ORG>
To:        Michael Stevens <mstevens@seshat.demon.co.uk>
Cc:        perlbug@perl.com, hackers@FreeBSD.ORG
Subject:   Re: bug in Time::Local (can't handle 1901)
Message-ID:  <20020308134627.F57999@blossom.cjclark.org>
In-Reply-To: <20020308164115.C2A165D02D@penfold.unixbeard.net>; from mstevens@seshat.demon.co.uk on Fri, Mar 08, 2002 at 04:41:15PM %2B0000
References:  <20020308164115.C2A165D02D@penfold.unixbeard.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Mar 08, 2002 at 04:41:15PM +0000, Michael Stevens wrote:
> This is a bug report for perl from mstevens@etla.org,
> generated with the help of perlbug 1.26 running under perl 5.00503.
> 
> 
> -----------------------------------------------------------------
> [Please enter your report here]
> 
> michaels@host:~> perl -MTime::Local -e 'timegm(0,0,0, 01, 01, 1901)'
> Can't handle date (0, 0, 0, 1, 1, 1) at -e line 1
> 
> This seems contrary to the documentation which suggests that this is
> a perfectly valid date that will be handled as 1901.

It so happens that the 2^31 seconds before the UNIX epcoh falls on
Fri Dec 13 20:45:52 UTC 1901.

  $ date -ju 190112132045.52
  Fri Dec 13 20:45:52 UTC 1901
  $ date -ju 190112132045.51
  date: nonexistent time
  $ date -ju 190112132045.52 +%s
  -2147483648
  $ dc
  2
  31^
  p
  2147483648

mktime(3) will choke on dates before Fri Dec 13 20:45:52 UTC 1901.
-- 
Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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