| 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 14 matching lines...) Expand all Loading... |
| 25 #include <mmsystem.h> | 25 #include <mmsystem.h> |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #include "webrtc/base/checks.h" | 28 #include "webrtc/base/checks.h" |
| 29 #include "webrtc/base/timeutils.h" | 29 #include "webrtc/base/timeutils.h" |
| 30 | 30 |
| 31 namespace rtc { | 31 namespace rtc { |
| 32 | 32 |
| 33 ClockInterface* g_clock = nullptr; | 33 ClockInterface* g_clock = nullptr; |
| 34 | 34 |
| 35 ClockInterface* SetClockForTesting(ClockInterface* clock) { | 35 void SetClock(ClockInterface* clock) { |
| 36 ClockInterface* prev = g_clock; | |
| 37 g_clock = clock; | 36 g_clock = clock; |
| 38 return prev; | |
| 39 } | 37 } |
| 40 | 38 |
| 41 uint64_t TimeNanos() { | 39 uint64_t TimeNanos() { |
| 42 if (g_clock) { | 40 if (g_clock) { |
| 43 return g_clock->TimeNanos(); | 41 return g_clock->TimeNanos(); |
| 44 } | 42 } |
| 45 int64_t ticks; | 43 int64_t ticks; |
| 46 #if defined(WEBRTC_MAC) | 44 #if defined(WEBRTC_MAC) |
| 47 static mach_timebase_info_data_t timebase; | 45 static mach_timebase_info_data_t timebase; |
| 48 if (timebase.denom == 0) { | 46 if (timebase.denom == 0) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (expiry_in_leap_year && month <= 2 - 1) // |month| is zero based. | 169 if (expiry_in_leap_year && month <= 2 - 1) // |month| is zero based. |
| 172 day -= 1; | 170 day -= 1; |
| 173 | 171 |
| 174 // Combine all variables into seconds from 1970-01-01 00:00 (except |month| | 172 // Combine all variables into seconds from 1970-01-01 00:00 (except |month| |
| 175 // which was accumulated into |day| above). | 173 // which was accumulated into |day| above). |
| 176 return (((static_cast<int64_t> | 174 return (((static_cast<int64_t> |
| 177 (year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + sec; | 175 (year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + sec; |
| 178 } | 176 } |
| 179 | 177 |
| 180 } // namespace rtc | 178 } // namespace rtc |
| OLD | NEW |