Skip to content

ICU-13845 Map to UTC-offset timezone when DST is off on Windows - #1297

Closed
jungshik wants to merge 3 commits into
unicode-org:masterfrom
jungshik:wintzdet
Closed

jungshik wants to merge 3 commits into
unicode-org:masterfrom
jungshik:wintzdet

Conversation

@jungshik

@jungshik jungshik commented Sep 3, 2020 •

Copy link
Copy Markdown
Contributor
  1. Try to detect when DST is turned off manually on Windows. (not tested)
    Find the non-DST offset and map a Windows timezone to a GMT+
    zone.

  2. Refactor uprv_detectWindowsTimeZone

Checklist

@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@jungshik

jungshik commented Sep 3, 2020

Copy link
Copy Markdown
Contributor Author

@jefgen , can you take a look? I haven't tried this PR to see if it fixes ICU-13845 (I meant to try it out on a VM, but haven't managed to). Could you advise on the detection of 'DST being off manually' part? Thank you !

* Try to detect when DST is turned off manually on Windows. (not tested)
Find the non-DST offset and map a Windows timezone to a GMT+
zone.

* Refactor uprv_detectWindowsTimeZone
@jira-pull-request-webhook

Copy link
Copy Markdown

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@jefgen jefgen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very kindly for creating this PR @jungshik!
I replied to your questions and left some comments/feedback on the changes.
Thanks again!

Comment thread icu4c/source/common/wintz.cpp Resolved
Comment thread icu4c/source/common/wintz.cpp Resolved
Comment thread icu4c/source/common/wintz.cpp Resolved
Comment thread icu4c/source/common/wintz.cpp Resolved
Comment thread icu4c/source/common/wintz.cpp Resolved
Comment thread icu4c/source/common/wintz.cpp Resolved
@jefgen jefgen self-assigned this Sep 4, 2020
@jefgen jefgen added the incomplete Needs work; do not approve/merge as is. label Sep 4, 2020
@jungshik

jungshik commented Sep 6, 2020

Copy link
Copy Markdown
Contributor Author

@jefgen Thank you for taking a look. Please, take another look. I addressed your comments. Thanks again.

@jungshik

jungshik commented Sep 6, 2020

Copy link
Copy Markdown
Contributor Author

@jefgen , PTAL. Thanks :-) !

// Note '-' before 'utcOffsetMin'. The timezone ID's sign convention
// is that a timezone ahead of UTC is Etc/GMT-<offset> and a timezone
// behind UTC is Etc/GMT+<offset>.
snprintf(gmtOffsetTz, 11, "Etc/GMT%+d", -utcOffsetMins / 60);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might also be good to check the return from snprintf, just to make sure that we don't exceed the buffer size of 11.
If we do, then there was somehow a bad value obtained from the dynamicTZI.Bias. This shouldn't happen, but it might be better to be defensive perhaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

incomplete Needs work; do not approve/merge as is.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants