PhoenixClock  2.6.0
Library wrapping the usage of system's clock, allowing to use clock mock-ups
Loading...
Searching...
No Matches
PTimer.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#ifndef __PTIMER_H__
8#define __PTIMER_H__
9
10#include "PGenericClock.h"
11
13class PTimer{
14 public:
15 PTimer(time_t ellapsedTime = 1lu);
16 PTimer(const PTimer & other);
17 PTimer(PTimer && other) noexcept;
18 virtual ~PTimer();
19 PTimer & operator = (const PTimer & other);
20 PTimer & operator = (PTimer && other) noexcept;
21
22 void setStartTime(time_t startTime);
23
24 void setEllapsedTime(time_t ellapsedTime);
25 time_t getEllapsedTime() const;
26
27 bool isTime(time_t currentTime);
28 bool isTime(time_t & ellapsedTimeNs, time_t currentTime);
29
30 protected:
31 void copyPTimer(const PTimer& other);
32
33 private:
35
40};
41
42#endif
43
time_t p_ellapsedTime
Ellapsed time between to isTime() returns true (in nanoseconds).
Definition PTimer.h:39
void setEllapsedTime(time_t ellapsedTime)
Set the ellapsed time in nanoseconds.
Definition PTimer.cpp:68
time_t getEllapsedTime() const
Get the ellapsed time in nanoseconds.
Definition PTimer.cpp:75
void setStartTime(time_t startTime)
Start the current clock.
Definition PTimer.cpp:61
PTimer(time_t ellapsedTime=1lu)
Default constructor of PTimer.
Definition PTimer.cpp:12
bool isTime(time_t currentTime)
Returns true if the given ellapsed time between to call is passed.
Definition PTimer.cpp:83
void initialisationPTimer()
Initialisation function of the class PTimer.
Definition PTimer.cpp:111
time_t p_startTime
Clock of the PTimer.
Definition PTimer.h:37
virtual ~PTimer()
Destructor of PTimer.
Definition PTimer.cpp:45
void copyPTimer(const PTimer &other)
Copy function of PTimer.
Definition PTimer.cpp:105
PTimer & operator=(const PTimer &other)
Definition of equal operator of PTimer.
Definition PTimer.cpp:53