1 #ifndef __JEEP__JTIMEKEEPER__
2 #define __JEEP__JTIMEKEEPER__
5 #include <sys/select.h>
20 namespace JPP {
using namespace JEEP; }
147 static const useconds_t MAXIMAL_SLEEP_TIME_US = std::numeric_limits<useconds_t>::max();
151 while (delay > MAXIMAL_SLEEP_TIME_US && usleep(MAXIMAL_SLEEP_TIME_US) == 0) {
154 delay -= MAXIMAL_SLEEP_TIME_US;
157 if (delay > 0 && usleep((useconds_t) delay) == 0) {
187 JTimeval timeout((
int) (delay/1000000), (
int) (delay%1000000));
210 mutable long long int t0;
long long int getDelay() const
Get total delay time.
bool wait(JFileDescriptorMask &mask) const
Wait until the number of time intervals has elapsed since the last call to the reset method or input ...
void reset(const long long int t0)
Reset time.
JTimekeeper(const long long int interval_us)
Constructor.
void wait() const
Wait until the number of time intervals has elapsed since the last call to the reset method...
Auxiliary class for time values.
static const JLocalTime getLocalTime
Function object to get local time in micro seconds.
Auxiliary class for method select.
JTimekeeper()
Default constructor.
long long int interval
interval time [us]
long long int getInterval() const
Get interval time.
long long int total_delay
total delay time [us]
bool operator()() const
Check whether the number of time intervals has elapsed since the last call to the reset method...
long long int t0
t0 of elapsed time [us]
long long int counter
interval counter
void setInterval(const long long int interval_us)
Set interval time.
bool in_avail(JTimeval timeout=JTimeval::min())
Check availability of input.