nidas v1.2.3
|
SampleClock adds date information to sample time tags. More...
#include <SampleClock.h>
Public Types | |
enum | status_t { NO_CLOCK , OUT_OF_SPEC , OK } |
Enumeration of the result of addSampleDate(). More... | |
Public Member Functions | |
SampleClock () | |
Constructor. | |
void | setMaxClockDiff (int val) |
void | setTime () |
Update the SampleClock from the UNIX OS clock. | |
status_t | addSampleDate (Sample *samp) |
Add date information to a sample time tag. | |
Static Public Member Functions | |
static SampleClock * | getInstance () |
Private Attributes | |
int | _maxClockDiffSec |
dsm_time_t | _t0day |
dsm_time_t | _clockTime |
Static Private Attributes | |
static SampleClock * | _instance = new SampleClock() |
SampleClock adds date information to sample time tags.
Sample timetags from the various NIDAS driver modules are only timetagged with the time since 00:00 GMT of the current day. SampleClock adds the day offset to the timetags, so that they are an absolute time.
Enumeration of the result of addSampleDate().
Enumerator | |
---|---|
NO_CLOCK | |
OUT_OF_SPEC | |
OK |
SampleClock::SampleClock | ( | ) |
Constructor.
References _clockTime, _t0day, nidas::util::getSystemTime(), nidas::util::timeFloor(), and USECS_PER_DAY.
SampleClock::status_t SampleClock::addSampleDate | ( | Sample * | samp | ) |
Add date information to a sample time tag.
samp | A Sample, whose timetag value is a relative time in microseconds since 00:00 GMT. |
References _clockTime, _maxClockDiffSec, _t0day, GET_DSM_ID, GET_SHORT_ID, nidas::core::getSample(), nidas::util::getSystemTime(), LOG_DEBUG, OK, OUT_OF_SPEC, SECS_PER_DAY, setTime(), USECS_PER_DAY, and USECS_PER_SEC.
|
inlinestatic |
References _instance.
Referenced by nidas::core::DriverSampleScanner::nextSample().
val | A check for reasonable sample times (seconds). If the sample time differs from the clock source time (as set by setTime) by more than maxClockDiff, then the state is set to OUT_OF_SPEC. |
References _maxClockDiffSec, and nidas::core::getSample().
void SampleClock::setTime | ( | ) |
Update the SampleClock from the UNIX OS clock.
References _clockTime, _t0day, nidas::util::getSystemTime(), nidas::util::timeFloor(), and USECS_PER_DAY.
Referenced by addSampleDate().
|
private |
Referenced by addSampleDate(), SampleClock(), and setTime().
|
staticprivate |
Referenced by getInstance().
|
private |
Referenced by addSampleDate(), and setMaxClockDiff().
|
private |
Referenced by addSampleDate(), SampleClock(), and setTime().