Commit b881cd04 authored by Etienne Bergeron's avatar Etienne Bergeron Committed by Chromium LUCI CQ

Check GetTimeZoneInformation(...) returned value

Based on the doc of the GetTimeZoneInformation(...) API
  https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-gettimezoneinformation

Returned value needs to be compare to the value TIME_ZONE_ID_INVALID (-1).

Follow up on a bug introduced here:
  https://chromium-review.googlesource.com/c/chromium/src/+/2583012

R=gab@chromium.org

Bug: 1074036
Change-Id: I7d227cd7a85b0b50eaea6be364012dee3d9357b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2631925Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Commit-Queue: Etienne Bergeron <etienneb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843963}
parent b3ccf549
...@@ -60,7 +60,8 @@ class TimeZoneMonitorWin : public TimeZoneMonitor { ...@@ -60,7 +60,8 @@ class TimeZoneMonitorWin : public TimeZoneMonitor {
std::string GetPlatformTimeZone() { std::string GetPlatformTimeZone() {
std::string timezone; std::string timezone;
TIME_ZONE_INFORMATION time_zone_information; TIME_ZONE_INFORMATION time_zone_information;
if (::GetTimeZoneInformation(&time_zone_information)) { if (::GetTimeZoneInformation(&time_zone_information) !=
TIME_ZONE_ID_INVALID) {
// StandardName field may be empty. // StandardName field may be empty.
timezone = base::WideToUTF8(time_zone_information.StandardName); timezone = base::WideToUTF8(time_zone_information.StandardName);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment