PhoenixClockMock  2.0.0
Tool to manipulate mock of clock (split, merge and get info)
main.cpp
Go to the documentation of this file.
1 
2 /***************************************
3  Auteur : Pierre Aubert
4  Mail : pierre.aubert@lapp.in2p3.fr
5  Licence : CeCILL-C
6 ****************************************/
7 
8 #include "PTimer.h"
9 
12 bool testPtimer(){
13  PTimer timer(1000l);
14  time_t currentTime = 0l;
15  timer.setStartTime(currentTime);
16  bool bRet = !timer.isTime(currentTime);
17  bRet&=timer.isTime(1000l);
18  return bRet;
19 }
20 
22  PTimer timer(1000l);
23  PTimer timer2(timer);
24  time_t currentTime = 0l;
25  timer.setEllapsedTime(currentTime);
26  bool bRet = timer.getEllapsedTime() == currentTime;
27  PTimer timer3;
28  timer3 = timer;
29  bRet&=timer3.getEllapsedTime() == currentTime;
30  return bRet;
31 }
32 
33 int main(int argc, char** argv){
34  bool b = testPtimer();
35  b&=testCopyPtimer();
36  return b-1;
37 }
38 
39 
int main(int argc, char **argv)
Definition: main.cpp:56
bool testCopyPtimer()
Definition: main.cpp:21
bool testPtimer()
test if setTimer works
Definition: main.cpp:12
Timer which allows to call function every time a defined ellapsed time is out.
Definition: PTimer.h:13
void setEllapsedTime(time_t ellapsedTime)
Set the ellapsed time in nanoseconds.
Definition: PTimer.cpp:50
time_t getEllapsedTime() const
Get the ellapsed time in nanoseconds.
Definition: PTimer.cpp:57
void setStartTime(time_t startTime)
Start the current clock.
Definition: PTimer.cpp:43
bool isTime(time_t currentTime)
Returns true if the given ellapsed time between to call is passed.
Definition: PTimer.cpp:65