Index: base/time_unittest.cc |
diff --git a/base/time_unittest.cc b/base/time_unittest.cc |
index ebe69eb6e3357234898f912025c817463950052a..474cd8726c330acf8c609e68a0bb78ab061fc3e3 100644 |
--- a/base/time_unittest.cc |
+++ b/base/time_unittest.cc |
@@ -140,3 +140,26 @@ TEST(TimeDelta, FromAndIn) { |
EXPECT_EQ(13.0, TimeDelta::FromMilliseconds(13).InMillisecondsF()); |
EXPECT_EQ(13, TimeDelta::FromMicroseconds(13).InMicroseconds()); |
} |
+ |
+#if defined(OS_LINUX) || defined(OS_WINDOWS) // TODO(deanm): Mac. |
+// Our internal time format is serialized in things like databases, so it's |
+// important that it's consistent across all our platforms. We use the 1601 |
+// Windows epoch as the internal format across all platforms. |
+TEST(TimeDelta, WindowsEpoch) { |
+ Time::Exploded exploded; |
+ exploded.year = 1970; |
+ exploded.month = 1; |
+ exploded.day_of_week = 0; // Should be unusued. |
+ exploded.day_of_month = 1; |
+ exploded.hour = 0; |
+ exploded.minute = 0; |
+ exploded.second = 0; |
+ exploded.millisecond = 0; |
+ Time t = Time::FromUTCExploded(exploded); |
+ // Unix 1970 epoch. |
+ EXPECT_EQ(GG_INT64_C(11644473600000000), t.ToInternalValue()); |
+ |
+ // We can't test 1601 epoch, since the system time functions on Linux |
+ // only compute years starting from 1900. |
+} |
+#endif |