| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2005 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2005 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // | 46 // |
| 47 // This method is not thread-safe; it should only be used when no other thread | 47 // This method is not thread-safe; it should only be used when no other thread |
| 48 // is running (for example, at the start/end of a unit test, or start/end of | 48 // is running (for example, at the start/end of a unit test, or start/end of |
| 49 // main()). | 49 // main()). |
| 50 // | 50 // |
| 51 // TODO(deadbeef): Instead of having functions that access this global | 51 // TODO(deadbeef): Instead of having functions that access this global |
| 52 // ClockInterface, we may want to pass the ClockInterface into everything | 52 // ClockInterface, we may want to pass the ClockInterface into everything |
| 53 // that uses it, eliminating the need for a global variable and this function. | 53 // that uses it, eliminating the need for a global variable and this function. |
| 54 ClockInterface* SetClockForTesting(ClockInterface* clock); | 54 ClockInterface* SetClockForTesting(ClockInterface* clock); |
| 55 | 55 |
| 56 // Returns previously set clock, or nullptr if no custom clock is being used. |
| 57 ClockInterface* GetClockForTesting(); |
| 58 |
| 56 // Returns the actual system time, even if a clock is set for testing. | 59 // Returns the actual system time, even if a clock is set for testing. |
| 57 // Useful for timeouts while using a test clock, or for logging. | 60 // Useful for timeouts while using a test clock, or for logging. |
| 58 int64_t SystemTimeNanos(); | 61 int64_t SystemTimeNanos(); |
| 59 int64_t SystemTimeMillis(); | 62 int64_t SystemTimeMillis(); |
| 60 | 63 |
| 61 // Returns the current time in milliseconds in 32 bits. | 64 // Returns the current time in milliseconds in 32 bits. |
| 62 uint32_t Time32(); | 65 uint32_t Time32(); |
| 63 | 66 |
| 64 // Returns the current time in milliseconds in 64 bits. | 67 // Returns the current time in milliseconds in 64 bits. |
| 65 int64_t TimeMillis(); | 68 int64_t TimeMillis(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // Note that this function obeys the system's idea about what the time | 120 // Note that this function obeys the system's idea about what the time |
| 118 // is. It is not guaranteed to be monotonic; it will jump in case the | 121 // is. It is not guaranteed to be monotonic; it will jump in case the |
| 119 // system time is changed, e.g., by some other process calling | 122 // system time is changed, e.g., by some other process calling |
| 120 // settimeofday. Always use rtc::TimeMicros(), not this function, for | 123 // settimeofday. Always use rtc::TimeMicros(), not this function, for |
| 121 // measuring time intervals and timeouts. | 124 // measuring time intervals and timeouts. |
| 122 int64_t TimeUTCMicros(); | 125 int64_t TimeUTCMicros(); |
| 123 | 126 |
| 124 } // namespace rtc | 127 } // namespace rtc |
| 125 | 128 |
| 126 #endif // WEBRTC_BASE_TIMEUTILS_H_ | 129 #endif // WEBRTC_BASE_TIMEUTILS_H_ |
| OLD | NEW |