Index: webrtc/base/timeutils.h |
diff --git a/webrtc/base/timeutils.h b/webrtc/base/timeutils.h |
index 4af0d9538f058f9d969f954cd9a7fb5620463fd7..180d3e6e675d38f75038b2849c64a54ab05686ce 100644 |
--- a/webrtc/base/timeutils.h |
+++ b/webrtc/base/timeutils.h |
@@ -31,6 +31,19 @@ static const int64_t kNumNanosecsPerMicrosec = |
typedef uint32_t TimeStamp; |
+class ClockInterface { |
+ public: |
+ virtual ~ClockInterface() {} |
+ virtual uint64_t TimeNanos() const = 0; |
+}; |
+ |
+// Sets the global source of time. This is useful mainly for unit tests. |
+// SetClock(nullptr) should be called before the ClockInterface is deleted. |
+// This method is not thread-safe; it should only be used when no other thread |
+// is running (for example, at the start/end of a unit test, or start/end of |
+// main()). |
+void SetClock(ClockInterface* clock); |
+ |
// Returns the current time in milliseconds in 32 bits. |
uint32_t Time32(); |