home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / perl / 4858 < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.5 KB  |  41 lines

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