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"
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 {
23 QuicTime MockClock::ApproximateNow() const {
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());