Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / net / quic / test_tools / mock_clock.cc
blob47f23808877954870f6cb1a30b9e8797251d6d8f
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "net/quic/test_tools/mock_clock.h"
7 namespace net {
9 MockClock::MockClock() : now_(QuicTime::Zero()) {
12 MockClock::~MockClock() {
15 void MockClock::AdvanceTime(QuicTime::Delta delta) {
16 now_ = now_.Add(delta);
19 QuicTime MockClock::Now() const {
20 return now_;
23 QuicTime MockClock::ApproximateNow() const {
24 return now_;
27 QuicWallTime MockClock::WallNow() const {
28 return QuicWallTime::FromUNIXSeconds(
29 now_.Subtract(QuicTime::Zero()).ToSeconds());
32 base::TimeTicks MockClock::NowInTicks() const {
33 base::TimeTicks ticks;
34 return ticks + base::TimeDelta::FromMicroseconds(
35 now_.Subtract(QuicTime::Zero()).ToMicroseconds());
38 } // namespace net