OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/time/time.h" | 5 #include "base/time/time.h" |
6 | 6 |
| 7 #include <stdint.h> |
7 #include <time.h> | 8 #include <time.h> |
8 | |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 exploded.year = 1970; | 825 exploded.year = 1970; |
826 exploded.month = 1; | 826 exploded.month = 1; |
827 exploded.day_of_week = 0; // Should be unusued. | 827 exploded.day_of_week = 0; // Should be unusued. |
828 exploded.day_of_month = 1; | 828 exploded.day_of_month = 1; |
829 exploded.hour = 0; | 829 exploded.hour = 0; |
830 exploded.minute = 0; | 830 exploded.minute = 0; |
831 exploded.second = 0; | 831 exploded.second = 0; |
832 exploded.millisecond = 0; | 832 exploded.millisecond = 0; |
833 Time t = Time::FromUTCExploded(exploded); | 833 Time t = Time::FromUTCExploded(exploded); |
834 // Unix 1970 epoch. | 834 // Unix 1970 epoch. |
835 EXPECT_EQ(GG_INT64_C(11644473600000000), t.ToInternalValue()); | 835 EXPECT_EQ(INT64_C(11644473600000000), t.ToInternalValue()); |
836 | 836 |
837 // We can't test 1601 epoch, since the system time functions on Linux | 837 // We can't test 1601 epoch, since the system time functions on Linux |
838 // only compute years starting from 1900. | 838 // only compute years starting from 1900. |
839 } | 839 } |
840 | 840 |
841 // We could define this separately for Time, TimeTicks and TimeDelta but the | 841 // We could define this separately for Time, TimeTicks and TimeDelta but the |
842 // definitions would be identical anyway. | 842 // definitions would be identical anyway. |
843 template <class Any> | 843 template <class Any> |
844 std::string AnyToString(Any any) { | 844 std::string AnyToString(Any any) { |
845 std::ostringstream oss; | 845 std::ostringstream oss; |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 | 1093 |
1094 TEST(TimeTicksLogging, DoesNotMakeStreamBad) { | 1094 TEST(TimeTicksLogging, DoesNotMakeStreamBad) { |
1095 std::ostringstream oss; | 1095 std::ostringstream oss; |
1096 oss << TimeTicks(); | 1096 oss << TimeTicks(); |
1097 EXPECT_TRUE(oss.good()); | 1097 EXPECT_TRUE(oss.good()); |
1098 } | 1098 } |
1099 | 1099 |
1100 } // namespace | 1100 } // namespace |
1101 | 1101 |
1102 } // namespace base | 1102 } // namespace base |
OLD | NEW |