This source file includes following definitions.
- AdvanceTime
- Now
- ApproximateNow
- WallNow
- NowInTicks
#include "net/quic/test_tools/mock_clock.h"
namespace net {
MockClock::MockClock() : now_(QuicTime::Zero()) {
}
MockClock::~MockClock() {
}
void MockClock::AdvanceTime(QuicTime::Delta delta) {
now_ = now_.Add(delta);
}
QuicTime MockClock::Now() const {
return now_;
}
QuicTime MockClock::ApproximateNow() const {
return now_;
}
QuicWallTime MockClock::WallNow() const {
return QuicWallTime::FromUNIXSeconds(
now_.Subtract(QuicTime::Zero()).ToSeconds());
}
base::TimeTicks MockClock::NowInTicks() const {
base::TimeTicks ticks;
return ticks + base::TimeDelta::FromMicroseconds(
now_.Subtract(QuicTime::Zero()).ToMicroseconds());
}
}