home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!gatech!news.byu.edu!eff!ckd
- From: ckd@eff.org (Christopher Davis)
- Subject: Re: bug in ctime.pl?
- In-Reply-To: pas@anchor.unh.edu's message of Tue, 21 Jul 1992 20:11:21 GMT
- Message-ID: <CKD.92Jul21220835@loiosh.eff.org>
- Sender: usenet@eff.org (NNTP News Poster)
- Nntp-Posting-Host: loiosh.eff.org
- Organization: Electronic Frontier Foundation Tech Central
- References: <1992Jul21.201121.15732@nic.unh.edu>
- Date: Wed, 22 Jul 1992 02:10:43 GMT
- Lines: 27
-
- Paul> == Paul A Sand <pas@anchor.unh.edu>
-
- Paul> Based on some peculiar behavior, I looked at the ctime.pl library
- Paul> file. It contains the line:
-
- Paul> $year += ($year < 70) ? 2000 : 1900;
-
- Paul> where $year is one of the elements returned from gmtime() or
- Paul> localtime(). Looking at the definitions of what *those* return,
- Paul> it seems the statement should be simply:
-
- Paul> $year += 1900;
-
- Paul> Or am I missing something subtle?
-
- The subtle thing you're missing will become clear in about 8 years, when
- your modified version tells you that it's 1900. This is okay if you're
- writing a real-time Diplomacy game program, but kinda sucks for use in
- other applications, if you know what I mean.
-
- The magic number 70 is from the Unix epoch of Jan 1, 1970.
-
- --
- Christopher Davis * ckd@eff.org * System Administrator, EFF * +1 617 864 0665
- ``The First Amendment is often inconvenient. But that is besides the
- point. Inconvenience does not absolve the government of its obligation
- to tolerate speech.'' --Justice Anthony Kennedy, in 91-155
-