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 the actual system time, even if a clock is set for testing. |
| 57 // Useful for timeouts while using a test clock, or for logging. |
| 58 uint64_t SystemTimeNanos(); |
| 59 int64_t SystemTimeMillis(); |
| 60 |
56 // Returns the current time in milliseconds in 32 bits. | 61 // Returns the current time in milliseconds in 32 bits. |
57 uint32_t Time32(); | 62 uint32_t Time32(); |
58 | 63 |
59 // Returns the current time in milliseconds in 64 bits. | 64 // Returns the current time in milliseconds in 64 bits. |
60 int64_t TimeMillis(); | 65 int64_t TimeMillis(); |
61 // Deprecated. Do not use this in any new code. | 66 // Deprecated. Do not use this in any new code. |
62 inline int64_t Time() { | 67 inline int64_t Time() { |
63 return TimeMillis(); | 68 return TimeMillis(); |
64 } | 69 } |
65 | 70 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 }; | 104 }; |
100 | 105 |
101 // Convert from std::tm, which is relative to 1900-01-01 00:00 to number of | 106 // Convert from std::tm, which is relative to 1900-01-01 00:00 to number of |
102 // seconds from 1970-01-01 00:00 ("epoch"). Don't return time_t since that | 107 // seconds from 1970-01-01 00:00 ("epoch"). Don't return time_t since that |
103 // is still 32 bits on many systems. | 108 // is still 32 bits on many systems. |
104 int64_t TmToSeconds(const std::tm& tm); | 109 int64_t TmToSeconds(const std::tm& tm); |
105 | 110 |
106 } // namespace rtc | 111 } // namespace rtc |
107 | 112 |
108 #endif // WEBRTC_BASE_TIMEUTILS_H_ | 113 #endif // WEBRTC_BASE_TIMEUTILS_H_ |
OLD | NEW |