-
-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICU-22041 Fix "Africa/Casablanca" show strange LONG displayName #2096
ICU-22041 Fix "Africa/Casablanca" show strange LONG displayName #2096
Conversation
The buggy behavior is not observable on ICU 70 but only on 71 and trunk |
The updated test work in 0f49e50 but broken since ee6433c
|
The root problem is getRawOffset() now return 3600000 instead of 0 after #2042 |
@yumaoka please see the problem demostrated by the test inside this PR |
This looks related https://mm.icann.org/pipermail/tz/2022-March/031331.html |
Sorry - I was sick since last week. Looking. |
@yumaoka see how the unit test break |
sorry to hear that. take care. |
OK - so the new test cases are failing. |
It looks the root cause is this line: icu/icu4c/source/i18n/olsontz.cpp Line 433 in e172195
ICU4J works fine, and I debugged the equivalent code side by side. uprv_getUTCtime() returns epoch milliseconds, but this code multiply it by U_MILLIS_PER_SECOND. This produces far future time. This is usually not a problem because many zones consist with transition table and final rule. And current date usually fell into final rule part. I think this bug affects zones that translation table is populated next 50 years - Casablanca, Sao_Paulo and some others fall into this category. And Casablanca's rule is ending with "DST" (in rearguard version), and it is treated as permanent DST. This looks very old bug sitting there nearly 20 years... |
so is the fix removing " * U_MILLIS_PER_SECOND" ? |
Yes. I was debugging the logic to compare the given time with transition data. The function expect epoch milliseconds as input. Java works, because the java implementation takes long (System.currentTimeMillis()). Then I noticed the value is 1000 times bigger comparing to Java version although transition data to be compared are same. |
Scary
so we have two other places has such code in rbtz.cpp |
So... I just change the code here. Could you approve? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
8a841d8
to
5b86e0b
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please verify that Java works correctly. I suggest a Java unit test.
ok, I will add a unit test soon. stay tune |
I'm also surprised such bug has been there. But as I mentioned above, the problematic code is only executed for very small number of zones, and only when the last transition populated by tz database is ending rule inconsistent with current. This is why it was not revealed for long time. getRawOffset() is old API created when ICU did not support historic transitions. And the implementation just retro-fitted to old behavior after historic transitions are supported. |
removed the (double) cast in C++ and add Java test. PTAL |
@sffc I will need your LGTM on chromium when I cherrypick since Jungshik is ooo this week. Better you also look at this now. |
sorry, hit the wrong botton |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Java test case also looks good.
f9333c8
to
86c6be2
Compare
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm tnx
Fix TimeZone name for "Africa/Casablanca" Remove 3 incorrect x 1000 which intend to turn a sec to ms value on already ms value. unicode-org/icu#2096 https://unicode-org.atlassian.net/browse/ICU-22041 Bug: chromium:1327340 Change-Id: Iad1ccb4c877f2d14c93df53e0153e57733dff122 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/deps/icu/+/3670474 Reviewed-by: Shane Carr (Chromium) <[email protected]>
Fix incorrect raw offset and display name of "Africa/Casablanca" caused by
extra
* U_MILLIS_PER_SECOND
before using return value ofuprv_getUTCtime() which is already in ms per source/common/putilimp.h
Adding test to show the issue
The code is currently only printout in -v mode
Running (notice the -v parameter)
get
Checklist