RESOLVED FIXED 11184
fixing failed two failed mozilla Date reg tests on windows
https://bugs.webkit.org/show_bug.cgi?id=11184
Summary fixing failed two failed mozilla Date reg tests on windows
Ian Eng
Reported 2006-10-06 00:03:01 PDT
Two failed test cases: ecma/Date/15.9.5.2-1.js, ecma/Date/15.9.5.2.js That's because Date.toString() doesn't adjust DST when computing UTC offset. For example, on WinXP, DST is set, following problem produces wrong results. var now = new Date(); print(now.toString()); var then = new Date(now.toString()); print(then.toString()); When DST is set, it produces: --> Thu Oct 05 2006 23:56:32 GMT-0800 (Pacific Daylight Time) --> Fri Oct 06 2006 00:56:32 GMT-0800 (Pacific Daylight Time) The problem comes from "now.toString()", it should be --> Thu Oct 05 2006 23:56:32 GMT-0700 (Pacific Daylight Time) and when DST is not set, it is 'GMT-0800'. I think the problem is in date_object.cpp, gmtoffset() function doesn't consider DST. I made a simple patch to fix it, but I am not expert on either KJS or Date. Someone please review it carefully.
Attachments
get correct GMT offset when DST is on (1.75 KB, patch)
2006-10-06 00:09 PDT, Ian Eng
darin: review-
revised patch (4.94 KB, patch)
2006-10-06 11:05 PDT, Ian Eng
kmccullough: review-
Ian Eng
Comment 1 2006-10-06 00:09:42 PDT
Created attachment 10943 [details] get correct GMT offset when DST is on
Darin Adler
Comment 2 2006-10-06 07:30:40 PDT
Comment on attachment 10943 [details] get correct GMT offset when DST is on We should not be doing a const_cast like this. If we need to make a change like this, then dateToMseconds should be changed to take a const tm*. (And, in passing, "dateToMseconds" is a strangely-capitalized name; we should fix that too. And it's very strange that isDST takes a const double& instead of a double. But neither of those has anything to do with this patch.)
Kevin McCullough
Comment 3 2006-10-06 09:51:14 PDT
This is my fault, and a fix will be in place today. For performance and accuracy reasons the gmtoffset function will be reverted to it's previous implementation.
Ian Eng
Comment 4 2006-10-06 11:05:36 PDT
Created attachment 10949 [details] revised patch Darin, thanks for your review. I took your suggestion and changed the first parameter of dateToMseconds to "const tm&". I did grep the function name in *.h and *.cpp under WebKit, all references found are in date_object.cpp. And these calls are fixed. I hope no other references are missed. As you mentioned that renaming of several other functions has nothing to do with this patch. I am not going to touch that part.
Kevin McCullough
Comment 5 2006-10-06 11:22:09 PDT
Comment on attachment 10949 [details] revised patch I think using const reference is a great idea. But gmtoffset in date_object.cpp has changed. Please see revision 16855.
Ian Eng
Comment 6 2006-10-06 13:03:30 PDT
(In reply to comment #5) > (From update of attachment 10949 [details] [edit]) > I think using const reference is a great idea. But gmtoffset in > date_object.cpp has changed. Please see revision 16855. > Cool, thanks.
Note You need to log in before you can comment on or make changes to this bug.