phoglund@webrtc.org | 4cebe6c | 2012-11-07 13:37:19 +0000 | [diff] [blame] | 1 | /* |
| 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.org | 5c8d9d3 | 2013-01-03 09:50:17 +0000 | [diff] [blame] | 11 | #include "webrtc/system_wrappers/interface/tick_util.h" |
phoglund@webrtc.org | 4cebe6c | 2012-11-07 13:37:19 +0000 | [diff] [blame] | 12 | |
| 13 | #include <cassert> |
| 14 | |
| 15 | namespace webrtc { |
| 16 | |
phoglund@webrtc.org | 5c8d9d3 | 2013-01-03 09:50:17 +0000 | [diff] [blame] | 17 | bool TickTime::use_fake_clock_ = false; |
| 18 | WebRtc_Word64 TickTime::fake_ticks_ = 0; |
phoglund@webrtc.org | 4cebe6c | 2012-11-07 13:37:19 +0000 | [diff] [blame] | 19 | |
| 20 | void TickTime::UseFakeClock(WebRtc_Word64 start_millisecond) { |
phoglund@webrtc.org | 5c8d9d3 | 2013-01-03 09:50:17 +0000 | [diff] [blame] | 21 | use_fake_clock_ = true; |
| 22 | fake_ticks_ = MillisecondsToTicks(start_millisecond); |
phoglund@webrtc.org | 4cebe6c | 2012-11-07 13:37:19 +0000 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | void TickTime::AdvanceFakeClock(WebRtc_Word64 milliseconds) { |
phoglund@webrtc.org | 5c8d9d3 | 2013-01-03 09:50:17 +0000 | [diff] [blame] | 26 | assert(use_fake_clock_); |
| 27 | fake_ticks_ += MillisecondsToTicks(milliseconds); |
phoglund@webrtc.org | 4cebe6c | 2012-11-07 13:37:19 +0000 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | } // namespace webrtc |