localtime and Win32: The april fool's bug 
Author Message
 localtime and Win32: The april fool's bug

I just ran into this while addressing a *really* bizarre bug having to do with
daylight savings.

You can find the full post on bugtraq, or any of the windows groups. I am only
posting the relevant details

Date: Thu, 7 Jan 1999 10:18:33 +0100
From: Richard M. Smith

Subject: The Windows "April Fools 2001" bug

January 7, 1999

I have discovered a serious bug in Windows which will cause
many Windows applications to give the incorrect time starting
on April 1, 2001.  Although this new bug is not technically a Y2K
bug, it is similar because programs will fail on a particular
day in the next century.

The bug causes Windows applications to give times which are off by one hour
even though the Windows clock shows the correct time.  The bug will continue
for one week until April 8th of 2001, when applications will again show the
correct time.  The bug occurs under Windows 95, 98, and NT.

The problem is caused by the Visual C++ runtime library being
confused and assuming that daylight saving time doesn't start until
April the 8th.  In fact, daylight saving time starts on April 1 in
the year 2001.  The confusion appears to be caused by the fact that
April 1 falls on a Sunday in the year 2001.  The same bug occurs
in other years where April 1 also falls on a Sunday.  The last time this
happened was in 1990 and after 2001 it will occur again in 2007.  If April 1
falls on any other day of the week, the bug does not occur.

I reported the bug to Microsoft on Jan. 5th and got confirmation of
from them on the evening of Jan. 6th.  At the present time, Microsoft told
me that they don't know when a fix will be available for the bug.

For some applications, users should be able to fix the
problem by downloading a new version of the Visual C++ runtime
library DLL, MSVCRT.DLL.  Since the DLL now ships as part of Windows,
I would assume the fixed DLL will be available of the Windows Update

Unfortunately not all applications can be corrected with a new release of
MSVCRT.DLL.  Any applications which statically links with the Visual C++
runtime will have to be fixed by the application vendor.  Users will
have to download the new releases of these kinds of applications.

In my testing, I believe that the bug was introduced in version 4.1 of
Visual C++.  It is present in versions 4.2, 5.0, and 6.0 according to
my testing.

At the present time, the bug has been confirmed only in North American
time zones.  Outside North America it is unknown if the same bug
exists or not.  If it does exists, it may occur on different days
and different years.

I have written a small program in C that tests for the problem.
The source code for the test program is attached to the end of this

This "April Fools 2001" bug is present in the localtime() function, but
is probably also in other functions defined in the C language "time.h"
header file.

-Raj Seshadri

to email me, please remove the obligatory spamblock

Sun, 21 Sep 2003 09:47:23 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Perl and the Windows April Fools 2001 bug

2. localtime () - perl's bug ?

3. localtime (perldoc -f localtime didn't help)

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

5. where is 'lst' Byte April 94p231

6. fooling a process' requests for input

7. Perl Book Author Signing at Powell's (Portland) April 10th

8. localtime bug in activestate 805

9. how 2 redirect STDERR/STDOUT? asks an April fool

10. bug in localtime()?

11. how 2 redirect STDERR/STDOUT? asks an April fool

12. BUG in localtime(time)?


Powered by phpBB® Forum Software