blob: a9957568c63ed70885ceef4288f18213d0ab0819 [file] [log] [blame]
phoglund@webrtc.org4cebe6c2012-11-07 13:37:19 +00001/*
2 * Copyright (c) 2012 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
phoglund@webrtc.org5c8d9d32013-01-03 09:50:17 +000011#include "webrtc/system_wrappers/interface/tick_util.h"
phoglund@webrtc.org4cebe6c2012-11-07 13:37:19 +000012
13#include <cassert>
14
15namespace webrtc {
16
phoglund@webrtc.org5c8d9d32013-01-03 09:50:17 +000017bool TickTime::use_fake_clock_ = false;
18WebRtc_Word64 TickTime::fake_ticks_ = 0;
phoglund@webrtc.org4cebe6c2012-11-07 13:37:19 +000019
20void TickTime::UseFakeClock(WebRtc_Word64 start_millisecond) {
phoglund@webrtc.org5c8d9d32013-01-03 09:50:17 +000021 use_fake_clock_ = true;
22 fake_ticks_ = MillisecondsToTicks(start_millisecond);
phoglund@webrtc.org4cebe6c2012-11-07 13:37:19 +000023}
24
25void TickTime::AdvanceFakeClock(WebRtc_Word64 milliseconds) {
phoglund@webrtc.org5c8d9d32013-01-03 09:50:17 +000026 assert(use_fake_clock_);
27 fake_ticks_ += MillisecondsToTicks(milliseconds);
phoglund@webrtc.org4cebe6c2012-11-07 13:37:19 +000028}
29
30} // namespace webrtc