diff options
Diffstat (limited to 'icing/util/clock.h')
-rw-r--r-- | icing/util/clock.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/icing/util/clock.h b/icing/util/clock.h index 9e57854..d987a4c 100644 --- a/icing/util/clock.h +++ b/icing/util/clock.h @@ -42,12 +42,12 @@ class Timer { virtual ~Timer() = default; // Returns the elapsed time from when timer started. - virtual int64_t GetElapsedMilliseconds() { + virtual int64_t GetElapsedMilliseconds() const { return GetElapsedNanoseconds() / 1000000; } // Returns the elapsed time from when timer started. - virtual int64_t GetElapsedNanoseconds() { + virtual int64_t GetElapsedNanoseconds() const { return GetSteadyTimeNanoseconds() - start_timestamp_nanoseconds_; } @@ -90,6 +90,8 @@ class ScopedTimer { } } + const Timer& timer() const { return *timer_; } + private: std::unique_ptr<Timer> timer_; std::function<void(int64_t)> callback_; |