Skip Menu |
Report information
Id: 1776
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: root [at] atrium.cardima.com
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: medium
Type: docs
Perl Version: 5.005_03
Fixed In: (no value)



Date: Fri, 12 Nov 1999 18:15:28 -0800
From: Phil Stracchino <root [...] atrium.cardima.com>
To: perlbug [...] perl.com
Subject: perl 5.005_03 i686-linux-thread localtime() is not Y2K clean
Download (untitled) / with headers
text/plain 2.9k
----------------------------------------------------------------- [Please enter your report here] It appears that localtime() is not properly Y2K clean. In a ticket submission tool: $submitdate{$ticket} = time; Later, in a ticket database browser: $submitdate = $dblist{'submitdate'}->{$ticket}; ($junk, $min, $hour, $mday, $junk, $year, $junk, $junk, $junk) = localtime($submitdate); $weekday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime($submitdate))[6]]; $month = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[(localtime($submitdate))[4]]; $date = sprintf ("%02d:%02d %s %s %d, %04d", $hour, $min, $weekday, $month, $mday, $year); The resulting formatted date: 17:32 Fri Nov 12, 0099 Adding 5 years worth of seconds to the value passed to localtime() results in a year of 0104. Workaround: Add 1900 to the year field. [Please do not change anything below this line] ----------------------------------------------------------------- --- Site configuration information for perl 5.00503: Configured by root at Tue Oct 19 15:55:17 PDT 1999. Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=linux, osvers=2.2.12, archname=i686-linux-thread uname='linux atrium 2.2.12 #4 thu sep 2 14:21:10 pdt 1999 i686 unknown ' hint=recommended, useposix=true, d_sigaction=define usethreads=define useperlio=undef d_sfio=undef Compiler: cc='cc', optimize='-O2', gccversion=2.95.1 19990816 (release) cppflags='-D_REENTRANT -Dbool=char -DHAS_BOOL -I/usr/local/include' ccflags ='-D_REENTRANT -Dbool=char -DHAS_BOOL -I/usr/local/include' stdchar='char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /shlib /lib /usr/lib libs=-lnsl -lndbm -lgdbm -ldbm -ldb -ldl -lm -lpthread -lc -lposix libc=/lib/libc.so.5.4.46, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: --- @INC for perl 5.00503: /usr/lib/perl5/5.00503/i686-linux-thread /usr/lib/perl5/5.00503 /usr/lib/perl5/site_perl/5.005/i686-linux-thread /usr/lib/perl5/site_perl/5.005 . --- Environment for perl 5.00503: HOME=/root LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH=/usr/local/lib LOGDIR (unset) PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin:/usr/bin/X11:/usr/openwin/bin:/usr/games:/scripts:/usr/lib/news/bin:/usr/local/majordomo:/usr/local/netscape:/usr/wp8/wpbin:/usr/local/DjVu:/usr/local/Acrobat4/bin:/usr/l ocal/RedCreek:. PERL_BADLANG (unset) SHELL=/bin/bash
To: root [...] atrium.cardima.com
Cc: perl5-porters [...] perl.org
Subject: Re: [ID 19991112.005] perl 5.005_03 i686-linux-thread localtime() is not Y2K clean
From: Chip Turner <chip [...] zfx.com>
Date: 12 Nov 1999 21:43:59 -0500
Download (untitled) / with headers
text/plain 982b
Phil Stracchino <root@atrium.cardima.com> writes: Show quoted text
> $submitdate = $dblist{'submitdate'}->{$ticket}; > ($junk, $min, $hour, $mday, $junk, $year, $junk, $junk, $junk) = localtime($submitdate); > $weekday = (Sun,Mon,Tue,Wed,Thu,Fri,Sat)[(localtime($submitdate))[6]]; > $month = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec)[(localtime($submitdate))[4]]; > $date = sprintf ("%02d:%02d %s %s %d, %04d", $hour, $min, $weekday, $month, $mday, $year); > > The resulting formatted date: 17:32 Fri Nov 12, 0099 > Adding 5 years worth of seconds to the value passed to localtime() results > in a year of 0104.
Not a bug. Read: perldoc -f localtime for details. You also might want to check strftime in the POSIX package for more robust date printing. Chip -- Chip Turner chip@ZFx.com Programmer, ZFx, Inc. www.zfx.com PGP key available at wwwkeys.us.pgp.net
Date: Fri, 12 Nov 1999 22:16:20 -0500
From: Ronald J Kimball <rjk [...] linguist.dartmouth.edu>
To: Phil Stracchino <root [...] atrium.cardima.com>
Cc: perl5-porters [...] perl.org
Subject: Re: [ID 19991112.005] perl 5.005_03 i686-linux-thread localtime() is not Y2K clean
Download (untitled) / with headers
text/plain 312b
On Fri, Nov 12, 1999 at 06:15:28PM -0800, Phil Stracchino wrote: Show quoted text
> > It appears that localtime() is not properly Y2K clean.
Show quoted text
> Workaround: Add 1900 to the year field.
It appears that you need to RTFM. Specifically the part of the FM for localtime() where it tells you to add 1900 to the year value. Ronald
To: perl5-porters [...] perl.org
Subject: Re: [ID 19991112.005] perl 5.005_03 i686-linux-thread localtime() is not Y2K clean
Date: Tue, 16 Nov 1999 13:23:34 -0500
From: Mark-Jason Dominus <mjd [...] plover.com>
Download (untitled) / with headers
text/plain 718b
On Fri, Nov 12, 1999 at 06:15:28PM -0800, Phil Stracchino wrote: Show quoted text
> > It appears that localtime() is not properly Y2K clean. > > Workaround: Add 1900 to the year field.
I am going to count the bogus error reports submitted to P5P during calendar year 2000. These will include: `The month is off by one!' `The year is wrong!' `It has a y2k problem!' `It says that 2000 is a leap year, but century years are exempt!' If you would like to try to guess how many of these reports are submitted, and you have a PAUSE id, you can register your guess at http://www.plover.com/~mjd/perl/y2k/y2k.cgi I will announce the winner in January 2001. Registration will close at the end of 1999.
To: Mark-Jason Dominus <mjd [...] plover.com>
Cc: perl5-porters [...] perl.org
Subject: Re: [ID 19991112.005] perl 5.005_03 i686-linux-thread localtime() is not Y2K clean
From: merlyn [...] stonehenge.com (Randal L. Schwartz)
Date: 16 Nov 1999 12:03:41 -0800
Download (untitled) / with headers
text/plain 446b
Show quoted text
>>>>> "Mark-Jason" == Mark-Jason Dominus <mjd@plover.com> writes:
Mark-Jason> I will announce the winner in January 2001. Shouldn't that be 19101? :-) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org