Clock that can be used in unit tests for time-dependent tests independent of wall clock. More...
#include <time-unit-test-clock.hpp>
Public Member Functions | |
UnitTestClock (const nanoseconds &startTime=UnitTestClockTraits< BaseClock >::getDefaultStartTime()) | |
void | advance (const nanoseconds &duration) |
Advance unit test clock by duration . More... | |
void | setNow (const nanoseconds &timeSinceEpoch) |
Explicitly set clock to timeSinceEpoch . More... | |
virtual std::string | getSince () const |
virtual BaseClock::time_point | getNow () const |
virtual boost::posix_time::time_duration | toPosixDuration (const typename BaseClock::duration &duration) const |
Public Member Functions inherited from ndn::time::CustomClock< BaseClock > | |
virtual | ~CustomClock () |
Clock that can be used in unit tests for time-dependent tests independent of wall clock.
This clock should be explicitly advanced with UnitTestClock<BaseClock>::advance() or set with UnitTestClock<BaseClock>::setNow() methods.
Definition at line 74 of file time-unit-test-clock.hpp.
|
explicit |
Definition at line 32 of file time-unit-test-clock.cpp.
void ndn::time::UnitTestClock< BaseClock >::advance | ( | const nanoseconds & | duration | ) |
Advance unit test clock by duration
.
Definition at line 67 of file time-unit-test-clock.cpp.
References ndn::time::SLEEP_AFTER_TIME_CHANGE().
void ndn::time::UnitTestClock< BaseClock >::setNow | ( | const nanoseconds & | timeSinceEpoch | ) |
Explicitly set clock to timeSinceEpoch
.
Definition at line 88 of file time-unit-test-clock.cpp.
References ndn::time::SLEEP_AFTER_TIME_CHANGE().
|
virtual |
Implements ndn::time::CustomClock< BaseClock >.
Definition at line 39 of file time-unit-test-clock.cpp.
|
virtual |
Implements ndn::time::CustomClock< BaseClock >.
Definition at line 46 of file time-unit-test-clock.cpp.
|
virtual |
Implements ndn::time::CustomClock< BaseClock >.
Definition at line 53 of file time-unit-test-clock.cpp.