blob: e709f883f3fe24646939c4c34d61fbebe24aa1d6 [file] [log] [blame]
henrike@webrtc.orgf0488722014-05-13 18:00:26 +00001/*
2 * Copyright 2008 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_BASE_TIMING_H_
12#define WEBRTC_BASE_TIMING_H_
13
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000014namespace rtc {
15
16class Timing {
17 public:
18 Timing();
19 virtual ~Timing();
20
21 // WallTimeNow() returns the current wall-clock time in seconds,
22 // within 10 milliseconds resolution.
tommi@webrtc.orgecb87232014-07-08 12:48:29 +000023 // WallTimeNow is static and does not require a timer_handle_ on Windows.
24 static double WallTimeNow();
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000025
26 // TimerNow() is like WallTimeNow(), but is monotonically
27 // increasing. It returns seconds in resolution of 10 microseconds
28 // or better. Although timer and wall-clock time have the same
29 // timing unit, they do not necessarily correlate because wall-clock
30 // time may be adjusted backwards, hence not monotonic.
31 // Made virtual so we can make a fake one.
tommi7d0d0e02016-01-25 03:09:29 -080032 // TODO(tommi): The only place we use this (virtual) is in
33 // rtpdata_engine_unittest.cc. See if it doesn't make more sense to change
34 // that contract or test than to modify this generic class.
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000035 virtual double TimerNow();
henrike@webrtc.orgf0488722014-05-13 18:00:26 +000036};
37
38} // namespace rtc
39
40#endif // WEBRTC_BASE_TIMING_H_