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
21
bool
testCopyPtimer
(){
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
PTimer.h
main
int main(int argc, char **argv)
Definition:
main.cpp:56
testCopyPtimer
bool testCopyPtimer()
Definition:
main.cpp:21
testPtimer
bool testPtimer()
test if setTimer works
Definition:
main.cpp:12
PTimer
Timer which allows to call function every time a defined ellapsed time is out.
Definition:
PTimer.h:13
PTimer::setEllapsedTime
void setEllapsedTime(time_t ellapsedTime)
Set the ellapsed time in nanoseconds.
Definition:
PTimer.cpp:50
PTimer::getEllapsedTime
time_t getEllapsedTime() const
Get the ellapsed time in nanoseconds.
Definition:
PTimer.cpp:57
PTimer::setStartTime
void setStartTime(time_t startTime)
Start the current clock.
Definition:
PTimer.cpp:43
PTimer::isTime
bool isTime(time_t currentTime)
Returns true if the given ellapsed time between to call is passed.
Definition:
PTimer.cpp:65
tmp_project
PhoenixClock
TESTS
TEST_PTIMER
main.cpp
Generated on Mon Jul 7 2025 16:09:09 for PhoenixClockMock by
1.9.1