-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Fix Time Zones Adjustment Rules on Linux #49733
Conversation
@eerhardt could you please have a look at this change? Thanks! |
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs
Outdated
Show resolved
Hide resolved
does this also fix #49491 ? |
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.
Are there any tests for these paths?
No, this is different issue talking about the serialization. We already have another issue tracking same issue, so I closed #49491. Also, this is old functionality, and we are not recommending it. In other word we should obsolete it.
What paths? we have many time zone tests in general under the System.Runtime. If you are talking about the serialization, it is broken functionality on Linux Systems and as I mentioned this should be obsoleted. |
Do you plan on adding tests before merging? |
src/libraries/System.Private.CoreLib/src/System/TimeZoneInfo.Unix.cs
Outdated
Show resolved
Hide resolved
I started to write the test but found would be better to write the test after exposing the rule UTC offset. Is it ok we can postpone the test till we expose the UTC offset? |
I would think we could at least write the test for an adjustment rule spanning multiple years, and verifying the data returned is correct. When the UTC offset API gets added, we can modify the test to verify the new UTC offset values are correct. |
I was trying to avoid assuming any rule in any time zone, but I am ok to add a test for like for |
We already have tests like this, which assume the exact rules of the runtime/src/libraries/System.Runtime/tests/System/TimeZoneInfoTests.cs Lines 1798 to 1820 in 9f93bcb
|
That is exactly the point I want to avoid. These tests fail on the platforms which has Julian rules we don't support. |
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.
This looks good to me. Only a couple minor/nit comments.
Thanks @tarekgh!
Fixes #20626 and #20624
When running on Linux based systems, we store the time zone adjustment rules differently than we store for Windows. When users ask for the adjustment rules for any zone, we try to convert the internal stored rules into the form that match Windows rules. We had some bugs in this conversion and this change is fixing that. The change in the code has some comment describing what we are doing during this conversion.
I tested this manually for some time zones, but I am going to add some test later to this PR.
Note, I am planning to export a new property in the adjustment rule to report the UTC offset for the rule. So, the list of the reported rules would be more useful even on Windows.