Go to the documentation of this file. 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;
Auxiliary class for time values.
long long int counter
interval counter
bool wait(JFileDescriptorMask &mask) const
Wait until the number of time intervals has elapsed since the last call to the reset method or input ...
bool operator()() const
Check whether the number of time intervals has elapsed since the last call to the reset method.
void wait() const
Wait until the number of time intervals has elapsed since the last call to the reset method.
General puprpose classes and methods.
JTimekeeper(const long long int interval_us)
Constructor.
void reset(const long long int t0)
Reset time.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const JLocalTime getLocalTime
Function object to get local time in micro seconds.
bool in_avail(JTimeval timeout=JTimeval::min())
Check availability of input.
JTimekeeper()
Default constructor.
Auxiliary class for method select.
long long int interval
interval time [us]
void setInterval(const long long int interval_us)
Set interval time.
long long int getInterval() const
Get interval time.
long long int t0
t0 of elapsed time [us]
long long int total_delay
total delay time [us]
long long int getDelay() const
Get total delay time.