Closed
Bug 2183
Opened 26 years ago
Closed 15 years ago
windows localtime() bug exposed in javascript Date object
Categories
(Core :: JavaScript Engine, defect, P5)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: mike+mozilla, Assigned: jlewinsohn)
References
()
Details
Attachments
(1 file)
(deleted),
text/html
|
Details |
From: "Richard M. Smith" <rms@pharlap.com>
Subject: The "April Fools Y2K" bug and JavaScript
To: jfriend@netscape.com
Hi John,
JavaScript has a pretty ugly Y2K bug thanks to Visual C++. The localtime()
function in the Visual C++ runtime library gets the wrong start date for
daylight savings time in the year 2001. Therefore all time values from April 1
thru April 7, 2001 are displayed incorrectly in JavaScript. (Windows 98
however gets the
DST start date right).
I found this "April Fools Y2K" bug this afternoon at work and just built a
JavaScript test case for it now:
document.writeln(new Date(0x3AC796D0 * 1000), "<br>");
document.writeln(new Date(0x3ACF2B70 * 1000), "<br>");
document.writeln(new Date(0x3AD06EE0 * 1000), "<br>");
outputs under Nav 4.5:
Sun Apr 01 16:00:00 GMT-0500 (Eastern Standard Time) 2001
Sat Apr 07 10:00:00 GMT-0500 (Eastern Standard Time) 2001
Sun Apr 08 10:00:00 GMT-0400 (Eastern Daylight Time) 2001
IE4 gets the same wrong answers.
The rule for the USA is that DST starts on the first Sunday in April. As
you can see, JavaScript says that April 1, 2001 is still on standard time.
I've already informed Microsoft of the problem. This is going to
be a huge mess because anyone who uses Visual C++ and calls
the localtime() function is going to have to do a rev of their software.
The VC++ bug seems to appear in any year in which April 1 falls
on a Sunday. The last time this happened was in 1990.
Richard
....
I have verified that this problem appears with our current javascript engine
under NT. The cleanest solution to this problem would be to build against a
patched version of the C libraries, or perhaps to direct the user to such a
patch if we link against the libraries dynamically.
Reporter | ||
Comment 1•26 years ago
|
||
added CCs
Reporter | ||
Comment 2•26 years ago
|
||
added CCs
Reporter | ||
Comment 3•26 years ago
|
||
More comments from Richard Smith -
Hi Mike,
I just built my APRIL1.C test program for the April Fools 2001 bug with all
versions of VC++ from version 2 to version 6. Looks like the bug was introduced
in version 4.1. I believe that VC++ 4.1 started shipping late summer 1996.
Attached is the results of my testing.
Richard
================================================================
vc2
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 17:00:00 EDT -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 11:00:00 EDT -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc4
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 17:00:00 EDT -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 11:00:00 EDT -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc41
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 16:00:00 EST -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 10:00:00 EST -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc42
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 16:00:00 EST -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 10:00:00 EST -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc5
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 16:00:00 EST -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 10:00:00 EST -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc6
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 16:00:00 EST -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 10:00:00 EST -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
Here is the build.bat file:
call vc2
cl -Fea1vc2 april1.c
call vc4
cl -Fea1vc4 april1.c
call vc41
cl -Fea1vc41 april1.c
call vc42
cl -Fea1vc42 april1.c
call vc5
cl -Fea1vc5 april1.c
call vc6
cl -Fea1vc6 april1.c
Reporter | ||
Comment 4•26 years ago
|
||
More comments from Richard Smith -
Hi Mike,
I just built my APRIL1.C test program for the April Fools 2001 bug with all
versions of VC++ from version 2 to version 6. Looks like the bug was introduced
in version 4.1. I believe that VC++ 4.1 started shipping late summer 1996.
Attached is the results of my testing.
Richard
================================================================
vc2
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 17:00:00 EDT -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 11:00:00 EDT -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc4
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 17:00:00 EDT -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 11:00:00 EDT -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc41
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 16:00:00 EST -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 10:00:00 EST -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc42
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 16:00:00 EST -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 10:00:00 EST -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc5
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 16:00:00 EST -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 10:00:00 EST -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
vc6
================================================================
0x3AC796D0 = Sunday, April 1, 2001 -- 16:00:00 EST -- DOY=90
0x3ACF2B70 = Saturday, April 7, 2001 -- 10:00:00 EST -- DOY=96
0x3AD06EE0 = Sunday, April 8, 2001 -- 10:00:00 EDT -- DOY=97
================================================================
Here is the build.bat file:
call vc2
cl -Fea1vc2 april1.c
call vc4
cl -Fea1vc4 april1.c
call vc41
cl -Fea1vc41 april1.c
call vc42
cl -Fea1vc42 april1.c
call vc5
cl -Fea1vc5 april1.c
call vc6
cl -Fea1vc6 april1.c
Reporter | ||
Updated•26 years ago
|
Status: NEW → ASSIGNED
Reporter | ||
Comment 5•26 years ago
|
||
Added norris to cc: list
Comment 7•26 years ago
|
||
per leger, assigning QA contacts to all open bugs without QA contacts according
to list at http://bugzilla.mozilla.org/describecomponents.cgi?product=Browser
Reporter | ||
Updated•26 years ago
|
Priority: P2 → P5
Target Milestone: M4 → M7
Reporter | ||
Comment 8•26 years ago
|
||
Setting to M7 until I have a better way to get this off the milestone radar.
This is not strictly our bug; I'm keeping it around to point to if anyone ever
blames us for the bug in the windows C runtime that causes this... and also as a
reminder to myself that I need to check in a javascript testcase for it.
Reporter | ||
Updated•25 years ago
|
Target Milestone: M7 → M15
Reporter | ||
Comment 9•25 years ago
|
||
Setting to m15. I still want it way off the radar. Also de-cc-ing Norris.
Comment 10•25 years ago
|
||
moving to the "JavaScript Engine" component.
Reporter | ||
Comment 11•25 years ago
|
||
Note to self. This should probably be a release note.
Reporter | ||
Updated•25 years ago
|
Target Milestone: M15 → M20
Reporter | ||
Comment 12•25 years ago
|
||
Moving to m20. It's still a placeholder bug.
Comment 13•25 years ago
|
||
Setting all Javacript bugs to rginda QA Contact.
QA Contact: cbegle → rginda
Reporter | ||
Comment 14•24 years ago
|
||
The day has come and gone...
Marking as WONTFIX.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → WONTFIX
Comment 16•23 years ago
|
||
Clocks in Europe went forward this week, and Win32 API agrees with me.
But MSVCRT doesn't :-(
Status: VERIFIED → REOPENED
Resolution: WONTFIX → ---
Comment 17•21 years ago
|
||
Um.. so are we supposed to reimplement the C lib's functionality just because?
WONTFIX sorta means "we know it's a bug, and we don't plan to do anything", no?
Comment 18•21 years ago
|
||
Comment 19•21 years ago
|
||
I must be missing something. This bug was filed on WinNT; I'm on WinNT;
but if I change my system timezone to East Coast time and load the testcase,
I do not see the bug. I have WinNT 4.0(SP6)
I've added a line for March 31, 2001 for more context.
The original report above says IE and Mozilla output this:
Sat Mar 31 2001 10:00:00 GMT-0500 (Eastern Standard Time)
Sun Apr 01 2001 16:00:00 GMT-0500 (Eastern Standard Time) <--- WRONG
Sat Apr 07 2001 10:00:00 GMT-0500 (Eastern Standard Time) <--- WRONG
Sun Apr 08 2001 10:00:00 GMT-0400 (Eastern Daylight Time)
But what I'm getting in Mozilla (and IE) is:
Sat Mar 31 2001 10:00:00 GMT-0500 (Eastern Standard Time)
Sun Apr 01 2001 17:00:00 GMT-0400 (Eastern Daylight Time)
Sat Apr 07 2001 11:00:00 GMT-0400 (Eastern Daylight Time)
Sun Apr 08 2001 10:00:00 GMT-0400 (Eastern Daylight Time)
Everything looks correct, doesn't it? Am I missing something?
Neil, what Windows OS are you running?
Assignee: mike+mozilla → khanson
Status: REOPENED → NEW
QA Contact: rginda → pschwartau
Comment 20•21 years ago
|
||
Note bug 127246: you have to actually restart Mozilla after
changing your Windows timezone, in order to see any effect.
I am doing that for greater ease of comparison, since the
original data above came from the East Coast timezone.
Comment 21•21 years ago
|
||
I'll see if I can find time to write a test case for my time zone.
Comment 23•20 years ago
|
||
FWIW, on WinXP2
FF Trunk
Sat Mar 31 2001 10:00:00 GMT-0500 (Eastern Standard Time)
Sun Apr 01 2001 17:00:00 GMT-0400 (Eastern Standard Time)
Sat Apr 07 2001 11:00:00 GMT-0400 (Eastern Standard Time)
Sun Apr 08 2001 10:00:00 GMT-0400 (Eastern Standard Time)
MSIE6
Sat Mar 31 10:00:00 EST 2001
Sun Apr 1 17:00:00 EDT 2001
Sat Apr 7 11:00:00 EDT 2001
Sun Apr 8 10:00:00 EDT 2001
Assignee | ||
Comment 24•19 years ago
|
||
not to self: you must fix this bug asap please!
change c library function 'localtime()' to suit and fix date problem.
version compatibility check!
Sat Mar 31 2001 10:00:00 GMT-1900 (Eastern Standard Time)
Sun Apr 01 2001 19:00:00 GMT-1900 (Eastern Standard Time)
Sat Apr 07 2001 10:00:00 GMT-1900 (Eastern Standard Time)
Sun Apr 08 2001 23:00:00 GMT-1900 (Eastern Daylight Time)
Updated•19 years ago
|
Assignee: date → jlewinsohn
Updated•18 years ago
|
QA Contact: pschwartau → general
Comment 25•15 years ago
|
||
If this was decided as a WONTFIX in 2000 then it's even more of a WONTFIX in 2009.
Status: NEW → RESOLVED
Closed: 24 years ago → 15 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•