Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Clock Class Referenceabstract

Virtual base class for a real-time clock. More...

#include <Clock.hxx>

Inheritance diagram for Clock:
MockClock RealClock

Public Member Functions

virtual long long get_time_nsec ()=0
 

Detailed Description

Virtual base class for a real-time clock.

The purpose for this base class is to have a real and a mock implementation. The Clock* pointer can be injected into components that need to use real time for business logic, and then tests can inject a mock or fake clock to drive the test scenario manually without needing to call sleep.

see RealClock and MockClock.

Definition at line 46 of file Clock.hxx.

Member Function Documentation

◆ get_time_nsec()

virtual long long Clock::get_time_nsec ( )
pure virtual
Returns
the current time of the clock in nanoseconds.

Implemented in RealClock, and MockClock.


The documentation for this class was generated from the following file: