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

OS.get_time_zone_info() does not adjust bias during DST #37571

Closed
Beefster09 opened this issue Apr 4, 2020 · 5 comments · Fixed by #59223
Closed

OS.get_time_zone_info() does not adjust bias during DST #37571

Beefster09 opened this issue Apr 4, 2020 · 5 comments · Fixed by #59223

Comments

@Beefster09
Copy link

Godot version: 3.2

OS/device including version: Windows 10

Issue description: When calling OS.get_time_zone_info() during part of the year when DST is active, the bias field returned does not take daylight saving time into account, so for instance, Mountain Daylight Time reads as a bias of 420 (7 hours) instead of 360 (6 hours). A bias of 420 would be correct for the standard time part of the year, but is incorrect when DST is active.

Steps to reproduce: Call OS.get_time_zone_info(), print the result to console, and observe the incorrect bias.

Minimal reproduction project: Any project will do.

@Calinou
Copy link
Member

Calinou commented Apr 4, 2020

It seems to be taken into account on Linux. I live in France (which is GMT+1), and I get the following on Linux: {bias:120, name:CEST}

This is probably OS-specific. Further testing on macOS, mobile and HTML5 is welcome.

Minimal reproduction project: test_date_bias.zip

@michasng
Copy link

I'm on windows 10 in germany. Should be getting a bias of 120 as well right now, but I get this:
{bias:60, name:Mitteleuropäische Sommerzeit}
(Also note that CEST has been automatically translated for me.)

Exporting to the web results in this:
{bias:120, name:GMT}
Now GMT is wrong, but the bias is correct.

@jamie-pate
Copy link
Contributor

jamie-pate commented Nov 16, 2020

Workaround on windows:

# Get time zone info with a bug fix for windows time zone issues.
func get_time_zone_info_fixed() -> Dictionary:
	var result = OS.get_time_zone_info()
	if OS.get_name() == "Windows":
		var output = []
                # NOTE: probably want to cache this result as it can open a cmd.exe popup every time you call it in windows :(
		OS.execute('WMIC.exe', ["OS","Get","CurrentTimeZone"],true, output)
		var bias = int(output[0].split("\n")[1])
		result.bias = bias
	return result

@bati22
Copy link

bati22 commented Jan 21, 2021

I tried to reproduce the bug, but failed. Maybe it's because it's winter time.
17

Godot version:
Godot 3.2.3.stable

OS/device including version:
Ubuntu 20.04.1 LTS

@jamie-pate
Copy link
Contributor

@bati22 afaik it only affects windows, and may only happen during Daylight Savings. You could set your computer clock to the summer to test.

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

Successfully merging a pull request may close this issue.

7 participants