| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 137 |
| 138 // Assert that 'tm' represents a time between 'before' and 'after'. | 138 // Assert that 'tm' represents a time between 'before' and 'after'. |
| 139 // mktime() uses local time, so we have to compensate for that. | 139 // mktime() uses local time, so we have to compensate for that. |
| 140 time_t local_delta = before - ::mktime(::gmtime(&before)); // NOLINT | 140 time_t local_delta = before - ::mktime(::gmtime(&before)); // NOLINT |
| 141 time_t t = ::mktime(&tm) + local_delta; | 141 time_t t = ::mktime(&tm) + local_delta; |
| 142 | 142 |
| 143 EXPECT_TRUE(before <= t && t <= after); | 143 EXPECT_TRUE(before <= t && t <= after); |
| 144 EXPECT_TRUE(0 <= microseconds && microseconds < 1000000); | 144 EXPECT_TRUE(0 <= microseconds && microseconds < 1000000); |
| 145 } | 145 } |
| 146 | 146 |
| 147 TEST(TimeTest, TestTimeDiff64) { |
| 148 int64_t ts_diff = 100; |
| 149 int64_t ts_earlier = rtc::Time64(); |
| 150 int64_t ts_later = ts_earlier + ts_diff; |
| 151 EXPECT_EQ(ts_diff, rtc::TimeDiff(ts_later, ts_earlier)); |
| 152 EXPECT_EQ(-ts_diff, rtc::TimeDiff(ts_earlier, ts_later)); |
| 153 } |
| 154 |
| 147 class TimestampWrapAroundHandlerTest : public testing::Test { | 155 class TimestampWrapAroundHandlerTest : public testing::Test { |
| 148 public: | 156 public: |
| 149 TimestampWrapAroundHandlerTest() {} | 157 TimestampWrapAroundHandlerTest() {} |
| 150 | 158 |
| 151 protected: | 159 protected: |
| 152 TimestampWrapAroundHandler wraparound_handler_; | 160 TimestampWrapAroundHandler wraparound_handler_; |
| 153 }; | 161 }; |
| 154 | 162 |
| 155 TEST_F(TimestampWrapAroundHandlerTest, Unwrap) { | 163 TEST_F(TimestampWrapAroundHandlerTest, Unwrap) { |
| 156 // Start value. | 164 // Start value. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 #endif | 294 #endif |
| 287 } | 295 } |
| 288 } | 296 } |
| 289 }; | 297 }; |
| 290 | 298 |
| 291 TEST_F(TmToSeconds, TestTmToSeconds) { | 299 TEST_F(TmToSeconds, TestTmToSeconds) { |
| 292 TestTmToSeconds(100000); | 300 TestTmToSeconds(100000); |
| 293 } | 301 } |
| 294 | 302 |
| 295 } // namespace rtc | 303 } // namespace rtc |
| OLD | NEW |