From 36679d572ba0b5bd363ee3ea8d02e9946c39e07d Mon Sep 17 00:00:00 2001 From: Scott Graham Date: Tue, 6 Feb 2018 11:34:20 -0800 Subject: [PATCH] win: Don't assume offsets the same when kDoesNotObserveDaylightSavingTime kDoesNotObserveDaylightSavingTime can indicate only that the standard/daylight transition is not automatic, as opposed to it not existing at all. Bug: crashpad:214 Change-Id: Ib7016806e79465a6dde605dd667b75a802e1b6c5 Reviewed-on: https://chromium-review.googlesource.com/904767 Commit-Queue: Scott Graham Reviewed-by: Mark Mentovai --- snapshot/win/system_snapshot_win_test.cc | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/snapshot/win/system_snapshot_win_test.cc b/snapshot/win/system_snapshot_win_test.cc index 4c994971..c87a6a6a 100644 --- a/snapshot/win/system_snapshot_win_test.cc +++ b/snapshot/win/system_snapshot_win_test.cc @@ -134,22 +134,24 @@ TEST_F(SystemSnapshotWinTest, TimeZone) { EXPECT_EQ(standard_offset_seconds % (15 * 60), 0) << "standard_offset_seconds " << standard_offset_seconds; - if (dst_status == SystemSnapshot::kDoesNotObserveDaylightSavingTime) { - EXPECT_EQ(daylight_offset_seconds, standard_offset_seconds); - EXPECT_EQ(daylight_name, standard_name); - } else { - EXPECT_EQ(daylight_offset_seconds % (15 * 60), 0) - << "daylight_offset_seconds " << daylight_offset_seconds; + // dst_status of kDoesNotObserveDaylightSavingTime can mean only that the + // adjustment is not automatic, as opposed to daylight/standard differences + // not existing at all. So it cannot be asserted that the two offsets are the + // same in that case. - // In contemporary usage, dst_delta_seconds will almost always be one hour, - // except for Lord Howe Island, Australia, which uses a 30-minute delta. - // Throughout history, other variations existed. See - // https://www.timeanddate.com/time/dst/. - int dst_delta_seconds = daylight_offset_seconds - standard_offset_seconds; - if (dst_delta_seconds != 60 * 60 && dst_delta_seconds != 30 * 60) { - FAIL() << "dst_delta_seconds " << dst_delta_seconds; - } + EXPECT_EQ(daylight_offset_seconds % (15 * 60), 0) + << "daylight_offset_seconds " << daylight_offset_seconds; + // In contemporary usage, dst_delta_seconds will almost always be one hour, + // except for Lord Howe Island, Australia, which uses a 30-minute delta. + // Throughout history, other variations existed. See + // https://www.timeanddate.com/time/dst/. + int dst_delta_seconds = daylight_offset_seconds - standard_offset_seconds; + if (dst_delta_seconds != 60 * 60 && dst_delta_seconds != 30 * 60) { + FAIL() << "dst_delta_seconds " << dst_delta_seconds; + } + + if (dst_status != SystemSnapshot::kDoesNotObserveDaylightSavingTime) { EXPECT_NE(standard_name, daylight_name); } }