23 #include "detail/monotonic-deadline-timer.hpp" 31 template<
class BaseClock>
33 : m_currentTime(startTime)
37 template<
class BaseClock>
41 return " since unit test clock advancements";
44 template<
class BaseClock>
45 typename BaseClock::time_point
48 return typename BaseClock::time_point(duration_cast<typename BaseClock::duration>(m_currentTime));
51 template<
class BaseClock>
52 boost::posix_time::time_duration
56 #ifdef BOOST_DATE_TIME_HAS_NANOSECONDS 57 boost::posix_time::nanoseconds(1)
59 boost::posix_time::microseconds(1)
65 template<
class BaseClock>
69 m_currentTime += duration;
82 boost::asio::time_traits<steady_clock>::to_posix_duration(duration));
86 template<
class BaseClock>
91 boost::asio::time_traits<steady_clock>::to_posix_duration(timeSinceEpoch -
93 m_currentTime = timeSinceEpoch;
std::string getSince() const override
Copyright (c) 2013-2017 Regents of the University of California.
void advance(const nanoseconds &duration)
Advance unit test clock by duration.
BaseClock::time_point getNow() const override
boost::posix_time::time_duration toPosixDuration(const typename BaseClock::duration &duration) const override
Clock that can be used in unit tests for time-dependent tests independent of wall clock...
UnitTestClock(const nanoseconds &startTime=UnitTestClockTraits< BaseClock >::getDefaultStartTime())
void setNow(const nanoseconds &timeSinceEpoch)
Explicitly set clock to timeSinceEpoch.
const std::chrono::microseconds SLEEP_AFTER_TIME_CHANGE(2)