Bug 137458

Summary: [Win] DateMath's calculateUTCOffset does not account for Daylight Savings Time
Product: WebKit Reporter: Brent Fulgham <bfulgham>
Component: WebCore Misc.Assignee: Brent Fulgham <bfulgham>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, bfulgham, cmarcelo, commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Bug Depends on:    
Bug Blocks: 137473    
Attachments:
Description Flags
Patch none

Description Brent Fulgham 2014-10-06 13:23:07 PDT
The code for the Windows path of "calculateUTCOffset" ignores the return value of GetTimeZoneInformation, and always acts as though the running machine is in the standard time zone.

This documentation in <http://msdn.microsoft.com/en-us/library/windows/desktop/ms724421(v=vs.85).aspx> clearly indicates a daylight-savings-time-specific return value that indicates that you should use the "daylight bias" portion of the time zone struct to calculate the correct offset.
Comment 1 Radar WebKit Bug Importer 2014-10-06 13:24:12 PDT
<rdar://problem/18559172>
Comment 2 Brent Fulgham 2014-10-06 13:30:43 PDT
Created attachment 239351 [details]
Patch
Comment 3 Brent Fulgham 2014-10-06 13:31:11 PDT
This bug may be why certain date-related tests are failing depending on user's time zone.
Comment 4 Geoffrey Garen 2014-10-06 13:34:35 PDT
Comment on attachment 239351 [details]
Patch

r=me

It would be nice to get clarity on whether our existing tests cover this, and to add a test to cover this if it's not already covered.
Comment 5 Brent Fulgham 2014-10-06 17:39:35 PDT
(In reply to comment #4)
> (From update of attachment 239351 [details])
> r=me
> 
> It would be nice to get clarity on whether our existing tests cover this, and to add a test to cover this if it's not already covered.

We have tests that check for correct calculation of DST-related dates, but we don't have a test that places the test machine in DST or Standard time zones for running the tests. This patch corrects a problem where the local machine state was not being accounted for when computed the time offset compared to UTC.

I'll think about this and see if we can come up with a reliable way to toggle this state during test runs.
Comment 6 Brent Fulgham 2014-10-06 17:42:19 PDT
See also <https://bugs.webkit.org/show_bug.cgi?id=137473> for better testing for this feature.
Comment 7 WebKit Commit Bot 2014-10-06 18:15:22 PDT
Comment on attachment 239351 [details]
Patch

Clearing flags on attachment: 239351

Committed r174377: <http://trac.webkit.org/changeset/174377>
Comment 8 WebKit Commit Bot 2014-10-06 18:15:26 PDT
All reviewed patches have been landed.  Closing bug.