develooper Front page | perl.perl5.porters | Postings from November 1999

[ID 19991112.005] perl 5.005_03 i686-linux-thread localtime() isnot Y2K clean

Thread Next
Phil Stracchino
November 12, 1999 18:15
[ID 19991112.005] perl 5.005_03 i686-linux-thread localtime() isnot Y2K clean
Message ID:

This is a bug report for perl from,
generated with the help of perlbug 1.26 running under perl 5.00503.

[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:
    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
    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/, 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:

Environment for perl 5.00503:
    LANG (unset)
    LANGUAGE (unset)
    LOGDIR (unset)

    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About