Bug 204032 - UTC offset for Samoa is miscalculated when !HAVE(TIMEGM)
Summary: UTC offset for Samoa is miscalculated when !HAVE(TIMEGM)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ross Kirsling
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-11-08 16:53 PST by Ross Kirsling
Modified: 2019-11-11 16:59 PST (History)
10 users (show)

See Also:


Attachments
Patch (1.61 KB, patch)
2019-11-08 16:57 PST, Ross Kirsling
no flags Details | Formatted Diff | Diff
Patch (5.62 KB, patch)
2019-11-11 15:48 PST, Ross Kirsling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Kirsling 2019-11-08 16:53:53 PST
UTC offset for Samoa is miscalculated when !HAVE(TIMEGM)
Comment 1 Ross Kirsling 2019-11-08 16:57:28 PST
Created attachment 383181 [details]
Patch
Comment 2 Ross Kirsling 2019-11-08 17:05:33 PST
Not sure if this is possible to test, but repro scenario on Mac is the following:
1. Set system time zone to that of Apia, Samoa.
2. Notice that `new Date().getTimezoneOffset() / -60` is 13 or 14.
3. Change #if HAVE(TIMEGM) and #if HAVE(TM_GMTOFF) to #if 0 in DateMath.cpp.
4. Notice that `new Date().getTimezoneOffset() / -60` is now -10 or -11.
Comment 3 Ross Kirsling 2019-11-08 17:14:18 PST
Also, please feel free to counter-suggest a more sustainable solution. :P
Comment 4 Yusuke Suzuki 2019-11-08 20:46:50 PST
Comment on attachment 383181 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=383181&action=review

> Source/WTF/ChangeLog:9
> +        but Samoa changed from UTC-11 to UTC+13 at the beginning of 2012.

Let's write a test by setting `TZ=Pacific/Samoa`!
You can extend run-jsc-stress-tests, maybe, extending runComplexTest, and pass environment variables as additionalEnv. And specify it from `complex.yaml` in JSTests.
Comment 5 Ross Kirsling 2019-11-11 13:27:15 PST
(In reply to Yusuke Suzuki from comment #4)
> Comment on attachment 383181 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=383181&action=review
> 
> > Source/WTF/ChangeLog:9
> > +        but Samoa changed from UTC-11 to UTC+13 at the beginning of 2012.
> 
> Let's write a test by setting `TZ=Pacific/Samoa`!
> You can extend run-jsc-stress-tests, maybe, extending runComplexTest, and
> pass environment variables as additionalEnv. And specify it from
> `complex.yaml` in JSTests.

Can do.

By the way, it turns out Pacific/Samoa is for American Samoa, which is still UTC-11; I guess the one we need here is Pacific/Apia. Talk about confusing!
(https://en.wikipedia.org/wiki/Time_in_Samoa)
Comment 6 Ross Kirsling 2019-11-11 15:48:25 PST
Created attachment 383307 [details]
Patch
Comment 7 Yusuke Suzuki 2019-11-11 16:30:04 PST
Comment on attachment 383307 [details]
Patch

r=me
Comment 8 WebKit Commit Bot 2019-11-11 16:58:47 PST
Comment on attachment 383307 [details]
Patch

Clearing flags on attachment: 383307

Committed r252345: <https://trac.webkit.org/changeset/252345>
Comment 9 WebKit Commit Bot 2019-11-11 16:58:49 PST
All reviewed patches have been landed.  Closing bug.
Comment 10 Radar WebKit Bug Importer 2019-11-11 16:59:23 PST
<rdar://problem/57099380>