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; |
+}; |
pthatcher1
2016/05/24 18:05:46
Can you put a TODO to move this into a clock.h? I
Taylor Brandstetter
2016/05/24 21:48:00
What do you mean by "new code start moving over"?
pthatcher1
2016/05/26 17:48:38
I mean we replace all uses of Timing with ClockInt
|
+ |
+// 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(); |