Perl and the Windows April Fools 2001 bug 
Author Message
 Perl and the Windows April Fools 2001 bug

Hello,

I have found a quasi-Y2K bug in Visual C++ (or possibly Windows).  It looks
like a program built with VC++ that calls the localtime() runtime library function
is going to get the wrong time of day from April 1, 2001 thru April 7, 2001.

A technical description of the bug can be found at:

    http://www.*-*-*.com/

A live test page for the bug can be found at:

    http://www.*-*-*.com/

My question, will Win32 Perl programs also fail on April 1, 2001
because the Windows Perl interpreter uses the broken Visual C++
localtime() function?  I am was hoping that someone could write
a quick test in Perl for this bug and post the results.

TIA,
Richard



Sat, 23 Jun 2001 03:00:00 GMT  
 Perl and the Windows April Fools 2001 bug

following:
=> Hello,

[snip]

=> My question, will Win32 Perl programs also fail on April 1, 2001
=> because the Windows Perl interpreter uses the broken Visual C++
=> localtime() function?  I am was hoping that someone could write
=> a quick test in Perl for this bug and post the results.

Well, you could directly translate the code in the article, but that's
messy...

How about:

#!/usr/bin/perl -w

print get_time(0x3AC796D0), "\n";  # Sunday,   April 1, 2001
print get_time(0x3ACF2B70), "\n";  # Saturday, April 7, 2001
print get_time(0x3AD06EE0), "\n";  # Sunday,   April 8, 2001

sub get_time {
        my $time = shift;

        $_  =  localtime($time);
        $_ .= (localtime($time))[8] ? " (DST)" : "";

Quote:
}

__END__
Sun Apr  1 16:00:00 2001
Sat Apr  7 10:00:00 2001
Sun Apr  8 10:00:00 2001 (DST)

---

perl -v :

This is perl, version 5.005_02 built for MSWin32-x86-object

Copyright 1987-1998, Larry Wall

Binary build 508 provided by ActiveState Tool Corp.
http://www.ActiveState.com
Built 16:22:15 Dec 22 1998
...

The above produces the correct results with my Linux based Perl, of
course. :)

=> TIA,

HTH,

=> Richard

--Matthew



Sun, 24 Jun 2001 03:00:00 GMT  
 Perl and the Windows April Fools 2001 bug
And, of course, compiled with EGCS on NT:

D:\PERL5\TMP>y2k_dst.plx
Sun Apr  1 16:00:00 2001 (DST)
Sat Apr  7 10:00:00 2001 (DST)
Sun Apr  8 09:00:00 2001 (DST)

D:\PERL5\TMP>perl -v

This is perl, version 5.005_02 built for MSWin32-x86

Copyright 1987-1998, Larry Wall

Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5.0 source
kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.

D:\PERL5\TMP>perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 02) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86
    uname=''
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-g -O2 ', gccversion=
    cppflags='-DWIN32'
    ccflags ='-g -O2  -DWIN32   '
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -Ld:\egcs-1.1\lib '
    libpth=d:\egcs-1.1\lib
    libs= -ladvapi32 -luser32 -lnetapi32 -lwsock32 -lmingw32 -lgcc
-lmoldname -lcrtdll -lkernel32
    libc=-lcrtdll, so=dll, useshrplib=yes, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll  -Ld:\egcs-1.1\lib '

Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY
  Built under MSWin32
  Compiled at Jan  2 1999 00:19:13

    d:\perl5\5.00502.egcs\lib/MSWin32-x86
    d:\perl5\5.00502.egcs\lib
    d:\perl5\site\5.00502.egcs\lib/MSWin32-x86
    d:\perl5\site\5.00502.egcs\lib
    d:\perl5\site\lib
    .

Quote:


> following:
> => Hello,

> [snip]

> => My question, will Win32 Perl programs also fail on April 1, 2001
> => because the Windows Perl interpreter uses the broken Visual C++
> => localtime() function?  I am was hoping that someone could write
> => a quick test in Perl for this bug and post the results.

> Well, you could directly translate the code in the article, but that's
> messy...

> How about:

> #!/usr/bin/perl -w

> print get_time(0x3AC796D0), "\n";  # Sunday,   April 1, 2001
> print get_time(0x3ACF2B70), "\n";  # Saturday, April 7, 2001
> print get_time(0x3AD06EE0), "\n";  # Sunday,   April 8, 2001

> sub get_time {
>         my $time = shift;

>         $_  =  localtime($time);
>         $_ .= (localtime($time))[8] ? " (DST)" : "";
> }
> __END__
> Sun Apr  1 16:00:00 2001
> Sat Apr  7 10:00:00 2001
> Sun Apr  8 10:00:00 2001 (DST)

> ---

> perl -v :

> This is perl, version 5.005_02 built for MSWin32-x86-object

> Copyright 1987-1998, Larry Wall

> Binary build 508 provided by ActiveState Tool Corp.
> http://www.ActiveState.com
> Built 16:22:15 Dec 22 1998
> ...

> The above produces the correct results with my Linux based Perl, of
> course. :)

> => TIA,

> HTH,

> => Richard

> --Matthew

--

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "



Sun, 24 Jun 2001 03:00:00 GMT  
 Perl and the Windows April Fools 2001 bug

Quote:
> My question, will Win32 Perl programs also fail on April 1, 2001
> because the Windows Perl interpreter uses the broken Visual C++
> localtime() function?  I am was hoping that someone could write
> a quick test in Perl for this bug and post the results.

even better:  add it into the test suite, along with one to make sure
the year returned in 11 months is 3 digits (not 2).
--



Wed, 04 Jul 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. localtime and Win32: The april fool's bug

2. Perl tutorials at U Penn on Monday April 14 and April 21

3. Perl Tutorial "Program Repair Shop and Red Flags" 23 April 2001

4. Perl Conference: European Yet Another Perl Conference 2001

5. Yet Another Perl Conference 2001 - Registration/Second CFP

6. CFP: Yet Another Perl Conference 2001

 

 
Powered by phpBB® Forum Software