diff --git a/runtime/vm/os_win.cc b/runtime/vm/os_win.cc index 9daec00e6f3c..9e5ea5519aaa 100644 --- a/runtime/vm/os_win.cc +++ b/runtime/vm/os_win.cc @@ -112,13 +112,11 @@ const char* OS::GetTimeZoneName(int64_t seconds_since_epoch) { } // Figure out whether we're in standard or daylight. - bool daylight_savings = (status == TIME_ZONE_ID_DAYLIGHT); - if (status == TIME_ZONE_ID_UNKNOWN) { - tm local_time; - if (LocalTime(seconds_since_epoch, &local_time)) { - daylight_savings = (local_time.tm_isdst == 1); - } + tm local_time; + if (!LocalTime(seconds_since_epoch, &local_time)) { + return ""; } + const bool daylight_savings = (local_time.tm_isdst == 1); // Convert the wchar string to a null-terminated utf8 string. wchar_t* wchar_name = daylight_savings ? zone_information.DaylightName diff --git a/tests/corelib/date_time7_test.dart b/tests/corelib/date_time7_test.dart index f59236a040ce..41f8a941c795 100644 --- a/tests/corelib/date_time7_test.dart +++ b/tests/corelib/date_time7_test.dart @@ -21,6 +21,8 @@ testLocal() { // // Hardcode some common timezones, in both their abbreviated and expanded // forms to account for differences between host platforms. + print(name); + print(offset); switch (name) { case "CET" || "Central European Time" || "Central European Standard Time": Expect.equals(1, offset.inHours); @@ -34,6 +36,8 @@ testLocal() { Expect.equals(-4, offset.inHours); case "PDT" || "Pacific Daylight Time": Expect.equals(-7, offset.inHours); + case "PST" || "Pacific Standard Time": + Expect.equals(-8, offset.inHours); case "CST" || "Central Standard Time": Expect.equals(-6, offset.inHours); case "CDT" || "Central Daylight Time":