From 4d43aba31eb3545be4c6d952cd5115df2be52d27 Mon Sep 17 00:00:00 2001 From: Marcelo Fernandez Date: Tue, 12 Feb 2019 21:41:19 -0300 Subject: Fix get_time_zone_info returning inverted bias on Windows/UWP --- platform/uwp/os_uwp.cpp | 4 +++- platform/windows/os_windows.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'platform') diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index ea4f63b49c..2498e5a7f5 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -579,7 +579,9 @@ OS::TimeZoneInfo OSUWP::get_time_zone_info() const { ret.name = info.StandardName; } - ret.bias = info.Bias; + // Bias value returned by GetTimeZoneInformation is inverted of what we expect + // For example on GMT-3 GetTimeZoneInformation return a Bias of 180, so invert the value to get -180 + ret.bias = -info.Bias; return ret; } diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 9ae1be9afd..96def5d3c1 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -2137,7 +2137,9 @@ OS::TimeZoneInfo OS_Windows::get_time_zone_info() const { ret.name = info.StandardName; } - ret.bias = info.Bias; + // Bias value returned by GetTimeZoneInformation is inverted of what we expect + // For example on GMT-3 GetTimeZoneInformation return a Bias of 180, so invert the value to get -180 + ret.bias = -info.Bias; return ret; } -- cgit v1.2.3