Bug 142531 - [Win] 17 different JSC tests started to fail in DST
Summary: [Win] 17 different JSC tests started to fail in DST
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brent Fulgham
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-10 05:43 PDT by Csaba Osztrogonác
Modified: 2015-03-11 00:02 PDT (History)
11 users (show)

See Also:


Attachments
Patch (1.41 KB, patch)
2015-03-10 13:54 PDT, peavo
no flags Details | Formatted Diff | Diff
Patch (3.66 KB, patch)
2015-03-10 19:07 PDT, Brent Fulgham
no flags Details | Formatted Diff | Diff
Patch (3.42 KB, patch)
2015-03-10 19:09 PDT, Brent Fulgham
cdumez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Csaba Osztrogonác 2015-03-10 05:43:55 PDT
Since daylight saving time is started in CA, 17 different date 
tests started to fail on Windows bots. (Apple Windows + WinCairo)

jsc-layout-tests.yaml/js/script-tests/date-parse-comments-test.js.layout
jsc-layout-tests.yaml/js/script-tests/date-parse-test.js.layout
jsc-layout-tests.yaml/js/script-tests/date-set-to-nan.js.layout
mozilla-tests.yaml/ecma/Date/15.9.3.1-1.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.1-2.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.1-3.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.1-4.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.1-5.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.2-1.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.2-2.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.2-3.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.2-4.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.3.2-5.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.4.2-1.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.5.26-1.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.5.27-1.js.mozilla
mozilla-tests.yaml/ecma/Date/15.9.5.30-1.js.mozilla

similar bugs: bug138303 and bug139123
Comment 1 peavo 2015-03-10 13:04:10 PDT
This might be wrong, but I get zero stress test failures, with the diff below.
It seems the documentation for GetTimeZoneInformation can be interpreted as the DST bias is already included in the bias member.
Maybe someone can confirm?


Index: DateMath.cpp
===================================================================
--- DateMath.cpp        (revisjon 181279)
+++ DateMath.cpp        (arbeidskopi)
@@ -369,11 +369,7 @@
     if (rc == TIME_ZONE_ID_INVALID)
         return 0;

-    int32_t bias = 0;
-    if (rc == TIME_ZONE_ID_DAYLIGHT)
-        bias = timeZoneInformation.Bias + timeZoneInformation.DaylightBias;
-    else if (rc == TIME_ZONE_ID_STANDARD || rc == TIME_ZONE_ID_UNKNOWN)
-        bias = timeZoneInformation.Bias + timeZoneInformation.StandardBias;
+    int32_t bias = timeZoneInformation.Bias;

     return -bias * 60 * 1000;
 #else
Comment 2 Alex Christensen 2015-03-10 13:33:24 PDT
I think you're right.  Put up a patch and let Brent double check it.  He wrote the code in question about 6 months ago, probably last time daylight savings time changed.
Comment 3 peavo 2015-03-10 13:54:34 PDT
Created attachment 248354 [details]
Patch
Comment 4 Brent Fulgham 2015-03-10 14:13:30 PDT
(In reply to comment #2)
> I think you're right.  Put up a patch and let Brent double check it.  He
> wrote the code in question about 6 months ago, probably last time daylight
> savings time changed.

I don't think this is right. The calculation was working properly while we were in DST, so at the very least I would expect the 'correct' code to still do the Bias calculation including the "DaylightBias" value.

According to <https://msdn.microsoft.com/en-us/library/windows/desktop/ms725481(v=vs.85).aspx>, StandardBias is normally zero. So "timeZoneInformation.Bias + timeZoneInformation.StandardBias" during standard time is equivalent to "timeZoneInformation.Bias".
Comment 5 Alex Christensen 2015-03-10 14:32:45 PDT
Well the current calculation is wrong right now.  I wish there were an easy way to test this without waiting 6 months to see how things change.  We should test this in Arizona, too :)
Comment 6 Brent Fulgham 2015-03-10 17:48:19 PDT
(In reply to comment #5)
> Well the current calculation is wrong right now.  I wish there were an easy
> way to test this without waiting 6 months to see how things change.  We
> should test this in Arizona, too :)

The current calculation is failing because 'GetTimeZoneInformation' is returning TIME_ZONE_ID_DAYLIGHT, instead of TIME_ZONE_ID_STANDARD.

The date that DST ends varies from year-to-year. Apparently this didn't get updated on Windows, or maybe the function I'm calling isn't smart enough to account for this.

According to MSDN, there is another function (in Vista and newer) that should do the right thing. I'll have to 'soft link' to it, since we don't know what OS we are running on, but that might fix it.

I'll give it a try and see.
Comment 7 Brent Fulgham 2015-03-10 19:07:21 PDT
Created attachment 248384 [details]
Patch
Comment 8 Brent Fulgham 2015-03-10 19:09:08 PDT
Created attachment 248385 [details]
Patch
Comment 9 Chris Dumez 2015-03-10 19:15:24 PDT
Comment on attachment 248385 [details]
Patch

r=me
Comment 10 Brent Fulgham 2015-03-10 19:34:29 PDT
Committed r181360: <http://trac.webkit.org/changeset/181360>
Comment 11 peavo 2015-03-11 00:02:55 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > Well the current calculation is wrong right now.  I wish there were an easy
> > way to test this without waiting 6 months to see how things change.  We
> > should test this in Arizona, too :)
> 
> The current calculation is failing because 'GetTimeZoneInformation' is
> returning TIME_ZONE_ID_DAYLIGHT, instead of TIME_ZONE_ID_STANDARD.
> 
> The date that DST ends varies from year-to-year. Apparently this didn't get
> updated on Windows, or maybe the function I'm calling isn't smart enough to
> account for this.
> 
> According to MSDN, there is another function (in Vista and newer) that
> should do the right thing. I'll have to 'soft link' to it, since we don't
> know what OS we are running on, but that might fix it.
> 
> I'll give it a try and see.

Great :) I thought DST already had started in the US (8. of March), but I guess that was not the case :)