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
From:
Phil Stracchino
Date:
November 12, 1999 18:15
Subject:
[ID 19991112.005] perl 5.005_03 i686-linux-thread localtime() isnot Y2K clean
Message ID:
199911130215.SAA06428@atrium.cardima.com

This is a bug report for perl from root@atrium.cardima.com,
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:
  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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About