![]() |
PhoenixClockMock
2.0.0
Tool to manipulate mock of clock (split, merge and get info)
|
Timer which allows to call function every time a defined ellapsed time is out. More...
#include <PTimer.h>
Public Member Functions | |
time_t | getEllapsedTime () const |
Get the ellapsed time in nanoseconds. More... | |
bool | isTime (time_t &ellapsedTimeNs, time_t currentTime) |
Returns true if the given ellapsed time between to call is passed. More... | |
bool | isTime (time_t currentTime) |
Returns true if the given ellapsed time between to call is passed. More... | |
PTimer & | operator= (const PTimer &other) |
Definition of equal operator of PTimer. More... | |
PTimer (const PTimer &other) | |
Copy constructor of PTimer. More... | |
PTimer (time_t ellapsedTime=1lu) | |
Default constructor of PTimer. More... | |
void | setEllapsedTime (time_t ellapsedTime) |
Set the ellapsed time in nanoseconds. More... | |
void | setStartTime (time_t startTime) |
Start the current clock. More... | |
virtual | ~PTimer () |
Destructor of PTimer. More... | |
Protected Member Functions | |
void | copyPTimer (const PTimer &other) |
Copy function of PTimer. More... | |
Private Member Functions | |
void | initialisationPTimer () |
Initialisation function of the class PTimer. More... | |
Private Attributes | |
time_t | p_ellapsedTime |
Ellapsed time between to isTime() returns true (in nanoseconds) More... | |
time_t | p_startTime |
Clock of the PTimer. More... | |
Timer which allows to call function every time a defined ellapsed time is out.
PTimer::PTimer | ( | time_t | ellapsedTime = 1lu | ) |
Default constructor of PTimer.
ellapsedTime | : ellapsed time between two calls (in nanoseconds) |
Definition at line 12 of file PTimer.cpp.
References initialisationPTimer().
PTimer::PTimer | ( | const PTimer & | other | ) |
Copy constructor of PTimer.
other | : class to copy |
Definition at line 22 of file PTimer.cpp.
References copyPTimer().
|
virtual |
|
protected |
Copy function of PTimer.
other | : class to copy |
Definition at line 87 of file PTimer.cpp.
References p_ellapsedTime, and p_startTime.
Referenced by operator=(), and PTimer().
time_t PTimer::getEllapsedTime | ( | ) | const |
Get the ellapsed time in nanoseconds.
Definition at line 57 of file PTimer.cpp.
References p_ellapsedTime.
Referenced by testCopyPtimer().
|
private |
Initialisation function of the class PTimer.
Definition at line 93 of file PTimer.cpp.
Referenced by PTimer().
bool PTimer::isTime | ( | time_t & | ellapsedTimeNs, |
time_t | currentTime | ||
) |
Returns true if the given ellapsed time between to call is passed.
[out] | ellapsedTimeNs | : real ellapsed time in nanoseconds between the call of isTime and the last start of the PTimer (maybe in another isTime) |
currentTime | : current time |
Definition at line 75 of file PTimer.cpp.
References p_ellapsedTime, p_startTime, and setStartTime().
bool PTimer::isTime | ( | time_t | currentTime | ) |
Returns true if the given ellapsed time between to call is passed.
currentTime | : current time |
Definition at line 65 of file PTimer.cpp.
Referenced by testPtimer().
Definition of equal operator of PTimer.
other | : class to copy |
Definition at line 35 of file PTimer.cpp.
References copyPTimer().
void PTimer::setEllapsedTime | ( | time_t | ellapsedTime | ) |
Set the ellapsed time in nanoseconds.
ellapsedTime | : ellapsed time in nanoseconds |
Definition at line 50 of file PTimer.cpp.
References p_ellapsedTime.
Referenced by testCopyPtimer().
void PTimer::setStartTime | ( | time_t | currentTime | ) |
Start the current clock.
currentTime | : current time |
Definition at line 43 of file PTimer.cpp.
References p_startTime.
Referenced by isTime(), and testPtimer().
|
private |
Ellapsed time between to isTime() returns true (in nanoseconds)
Definition at line 37 of file PTimer.h.
Referenced by copyPTimer(), getEllapsedTime(), isTime(), and setEllapsedTime().
|
private |
Clock of the PTimer.
Definition at line 35 of file PTimer.h.
Referenced by copyPTimer(), isTime(), and setStartTime().