소스 검색

Merge pull request #25842 from marcelofg55/windows_timezone

Fix get_time_zone_info returning inverted bias on Windows/UWP
Rémi Verschelde 6 년 전
부모
커밋
bc9c1e899e
2개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 1
      platform/uwp/os_uwp.cpp
  2. 3 1
      platform/windows/os_windows.cpp

+ 3 - 1
platform/uwp/os_uwp.cpp

@@ -579,7 +579,9 @@ OS::TimeZoneInfo OS_UWP::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;
 }
 

+ 3 - 1
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;
 }