Clock that can be used in unit tests for time-dependent tests independent of wall clock. More...
#include <ndn-cxx/util/time-unit-test-clock.hpp>
Public Member Functions | |
UnitTestClock (nanoseconds startTime=ClockTraits::getDefaultStartTime()) | |
void | advance (nanoseconds duration) |
Advance unit test clock by duration . More... | |
BaseClock::time_point | getNow () const override |
std::string | getSince () const override |
void | setNow (nanoseconds timeSinceEpoch) |
Explicitly set clock to timeSinceEpoch . More... | |
BaseClock::duration | toWaitDuration (typename BaseClock::duration d) const override |
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 73 of file time-unit-test-clock.hpp.
|
explicit |
Definition at line 32 of file time-unit-test-clock.cpp.
void ndn::time::UnitTestClock< BaseClock, ClockTraits >::advance | ( | nanoseconds | duration | ) |
Advance unit test clock by duration
.
Definition at line 60 of file time-unit-test-clock.cpp.
|
overridevirtual |
Implements ndn::time::CustomClock< BaseClock >.
Definition at line 46 of file time-unit-test-clock.cpp.
|
overridevirtual |
Implements ndn::time::CustomClock< BaseClock >.
Definition at line 39 of file time-unit-test-clock.cpp.
void ndn::time::UnitTestClock< BaseClock, ClockTraits >::setNow | ( | nanoseconds | timeSinceEpoch | ) |
Explicitly set clock to timeSinceEpoch
.
Definition at line 81 of file time-unit-test-clock.cpp.
|
overridevirtual |
Implements ndn::time::CustomClock< BaseClock >.
Definition at line 53 of file time-unit-test-clock.cpp.