Closed
Bug 485013
Opened 16 years ago
Closed 16 years ago
jsdate.cpp AdjustTime() breaks London (GMT+0) dates when DST activates Mar 29 2009
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.9.2a1
People
(Reporter: andrew, Assigned: crowderbt)
References
Details
(Keywords: regression, verified1.9.1, Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
724 bytes,
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7
Build Identifier: mozilla-central
Previously, AdjustTime() used to be a macro:
#define AdjustTime(t) fmod(LocalTZA + DaylightSavingTA(t), msPerDay)
It was changed to a function in the following rev:
http://hg.mozilla.org/mozilla-central/diff/d2b395fc397e/js/src/jsdate.cpp
static jsdouble
AdjustTime(jsdouble date)
{
jsdouble t = DaylightSavingTA(date) + LocalTZA;
t = (LocalTZA > 0) ? fmod(t, msPerDay) : -fmod(msPerDay - t, msPerDay);
return t;
}
If the LocalTZA is 0 or -0, the -fmod case will be used, causing the date offset to be incorrect. From what I can tell, this will occur for all UK users when DST goes into effect there Mar 29, 2009 at 2am.
Reproducible: Always
Steps to Reproduce:
In order to reproduce this easily in the US, simple hacks to prmjtime.cpp can be made to simulate London with DST enabled:
JSInt32
PRMJ_LocalGMTDifference()
{
return 0;
}
JSInt64
PRMJ_DSTOffset(JSInt64 local_time)
{
JSInt64 retval;
JSLL_I2L(retval, 60*60);
JSLL_MUL(retval, retval, 1000);
JSLL_MUL(retval, retval, 1000);
return retval;
}
Actual Results:
With the above prmjtime.cpp hacks in place:
js> new Date(2009, 3, 1)
Wed Apr 01 2009 00:00:00 GMT-2300
Expected Results:
With the above prmjtime.cpp hacks in place as well as a (dumb dumb) patch to jsdate.cpp to illustrate the expected value:
if (LocalTZA == 0 || LocalTZA == -0)
t = fmod(t, msPerDay);
else
t = (LocalTZA > 0) ? fmod(t, msPerDay) : -fmod(msPerDay - t, msPerDay);
js> new Date(2009, 3, 1)
Wed Apr 01 2009 00:00:00 GMT+0100
Comment 1•16 years ago
|
||
We can't regress this if it's valid. Marking NEW for Andrew.
/be
Assignee | ||
Comment 2•16 years ago
|
||
So we should just be using LocalTZA >= 0, instead of LocalTZA > 0 .... right? Or am I missing something?
Reporter | ||
Comment 3•16 years ago
|
||
I wasn't sure if LocalTZA >= 0 would catch the -0 case. It appears to in a simple test, so that should work.
Comment 4•16 years ago
|
||
-0 == 0, so yes, >= 0 should work (assuming LocalTZA is a jsdouble).
Assignee | ||
Comment 5•16 years ago
|
||
This doesn't regress the Venezuela bug, either... yay. :)
Assignee: general → crowder
Attachment #369120 -
Flags: review?(mrbkap)
Assignee | ||
Comment 6•16 years ago
|
||
And yes, all this math is done with jsdoubles. Thanks for the reassurance, Andreas.
Updated•16 years ago
|
Attachment #369120 -
Flags: review?(mrbkap) → review+
Comment 7•16 years ago
|
||
Let's get this into tm first, m-c next, and 1.9.1 when sayrer says so or does the deed. Main thing is tm first. Thanks,
/be
Assignee | ||
Updated•16 years ago
|
Keywords: checkin-needed
Updated•16 years ago
|
Flags: blocking1.9.1? → blocking1.9.1+
Comment 8•16 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 9•16 years ago
|
||
Comment 11•15 years ago
|
||
Verified fixed with testcase in comment 0 with the following debug builds:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre)
Gecko/20090522 Minefield/3.6a1pre ID:20090522133810
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1pre)
Gecko/20090522 Shiretoko/3.5pre ID:20090522153422
Haven't we tests which checks for time correctness?
Status: RESOLVED → VERIFIED
Flags: in-testsuite?
Target Milestone: --- → mozilla1.9.2a1
Version: unspecified → Trunk
You need to log in
before you can comment on or make changes to this bug.
Description
•