Jpp
test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
software
DataQueue
FrameFactory
timer.cc
Go to the documentation of this file.
1
#include "
timer.hh
"
2
3
/**
4
* \author cpellegrino
5
*/
6
7
bool
Timer::hasExpiredWrt
(
Timer
const
& t)
const
8
{
9
if
(t.tv_sec > tv_sec)
10
return
true
;
11
12
if
(t.tv_sec < tv_sec)
13
return
false
;
14
15
if
(t.tv_usec > tv_usec)
16
return
true
;
17
18
return
false
;
19
}
20
21
bool
Timer::hasExpired
()
const
22
{
23
Timer
const
t(0, 0);
24
return
Timer::hasExpiredWrt
(t);
25
}
26
27
void
Timer::set
(
long
int
seconds,
long
int
useconds)
28
{
29
static
const
int
usec_in_a_sec = 1000000;
30
31
gettimeofday(
this
, 0);
32
33
tv_sec += seconds;
34
tv_usec += useconds;
35
tv_sec += (tv_usec) / usec_in_a_sec;
36
tv_usec %= usec_in_a_sec;
37
}
Timer
Definition
timer.hh:11
Timer::hasExpiredWrt
bool hasExpiredWrt(Timer const &t) const
Definition
timer.cc:7
Timer::set
void set(long int seconds, long int useconds)
Definition
timer.cc:27
Timer::hasExpired
bool hasExpired() const
Definition
timer.cc:21
timer.hh
Generated by
1.12.0