0 votes

Using Godot 3.0.x, when I call OS.get_time_zone_info from Windows 10, I'm getting the exact opposite bias (positive/negative) as I am when calling it from Android (running Android 7.1.2 / Xiaomi MIUI Global 9.6).

For example: if the timezone is +8 for both devices, Windows will return a bias of -480 and Android will return 480.

I've noticed it doesn't matter what timezone the devices are set for either device, Windows will return negative a bias if the timezone is UTC+ and a positive bias if it is UTC-. And the exact opposite for my Android.

So, a couple questions if anyone is able to help me, even in part:

1. Is this a bug with OS.get_time_zone_info on certain platforms, perhaps? Or is one of my devices returning incorrect timezone information?

2. Which bias is the correction/intend offset? (Should UTC+ timezone return a positive bias or a negative bias, etc?)

Thanks for any help with this at all. Even knowing what the intended bias is for time zones will be enough to keep going forward with development while everything else gets sorted out. Very much appreciated! :)

in Engine by (21 points)

1 Answer

0 votes

Probably this


Get time zone info with a bug fix for windows time zone issues.

func gettimezoneinfofixed() -> Dictionary:
var result = OS.gettimezoneinfo()
if OS.get
name() == "Windows":
var output = []
OS.execute('WMIC.exe', ["OS","Get","CurrentTimeZone"],true, output)
var bias = int(output[0].split("\n")[1])
result.bias = bias
return result

by (20 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.