Skip to content
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 local timezones without DST on Windows #13516

Conversation

HertzDevil
Copy link
Contributor

Fixes #13502.

Also the Time::Location specs will now attempt to enable the SeTimeZonePrivilege privilege in the spec process before temporarily changing the system time zone.

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:windows Windows support based on the MSVC toolchain / Win32 API kind:specs topic:stdlib:time labels May 29, 2023
@straight-shoota
Copy link
Member

straight-shoota commented Jun 5, 2023

I'm wondering why is the extra steps necessary for aquiring SeTimeZonePrivilege? Are there reasonable use cases where this is missing?
I suppose it doesn't hurt, but it adds some code and I'm not sure what it's actually good for...

@HertzDevil
Copy link
Contributor Author

SeTimeZonePrivilege is granted but disabled for all users by default, including administrators, so anything that needs to change the system time zone with Win32 must go through this

Copy link
Member

@straight-shoota straight-shoota left a comment

Choose a reason for hiding this comment

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

I'd like to have this explanation in a code comment.

@straight-shoota straight-shoota added this to the 1.9.0 milestone Jun 14, 2023
@straight-shoota straight-shoota merged commit cf796c9 into crystal-lang:master Jun 18, 2023
@HertzDevil HertzDevil deleted the bug/windows-timezone-without-dst branch June 19, 2023 05:49
Blacksmoke16 pushed a commit to Blacksmoke16/crystal that referenced this pull request Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. kind:specs platform:windows Windows support based on the MSVC toolchain / Win32 API topic:stdlib:time
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Cannot load local time zone without DST on Windows
2 participants