10 #ifndef logger_types_telem_chrony_stats_hpp
11 #define logger_types_telem_chrony_stats_hpp
13 #include "generated/telem_chrony_stats_generated.h"
64 return VerifyTelem_chrony_stats_fbBuffer(verifier);
72 static_cast<void>(len);
75 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
77 std::string
msg =
"[chrony_stats] ";
80 snprintf(num,
sizeof(num),
"%g",fbs->systemTime());
84 snprintf(num,
sizeof(num),
"%g",fbs->lastOffset());
88 snprintf(num,
sizeof(num),
"%g",fbs->rmsOffset());
92 snprintf(num,
sizeof(num),
"%g",fbs->freq());
96 snprintf(num,
sizeof(num),
"%g",fbs->residFreq());
100 snprintf(num,
sizeof(num),
"%g",fbs->skew());
103 msg +=
" root_del: ";
104 snprintf(num,
sizeof(num),
"%g",fbs->rootDelay());
107 msg +=
" root_disp: ";
108 snprintf(num,
sizeof(num),
"%g",fbs->rootDispersion());
112 msg += std::to_string(fbs->updateInt());
120 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
121 return fbs->systemTime();
126 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
127 return fbs->lastOffset();
132 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
133 return fbs->rmsOffset();
136 static double freq(
void * msgBuffer )
138 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
144 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
145 return fbs->residFreq();
148 static double skew(
void * msgBuffer )
150 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
156 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
157 return fbs->rootDelay();
162 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
163 return fbs->rootDispersion();
168 auto fbs = GetTelem_chrony_stats_fb(msgBuffer);
169 return fbs->updateInt();
179 if(member ==
"systemTime")
return reinterpret_cast<void*
>(&
systemTime);
180 if(member ==
"lastOffset")
return reinterpret_cast<void*
>(&
lastOffset);
181 if(member ==
"rmsOffset")
return reinterpret_cast<void*
>(&
rmsOffset);
182 if(member ==
"freq")
return reinterpret_cast<void*
>(&
freq);
183 if(member ==
"residFreq")
return reinterpret_cast<void*
>(&
residFreq);
184 if(member ==
"skew")
return reinterpret_cast<void*
>(&
skew);
185 if(member ==
"rootDelay")
return reinterpret_cast<void*
>(&
rootDelay);
186 if(member ==
"rootDispersion")
return reinterpret_cast<void*
>(&
rootDispersion);
187 if(member ==
"updateInt")
return reinterpret_cast<void*
>(&
updateInt);
190 std::cerr <<
"No string member " << member <<
" in telem_chrony_stats\n";
The MagAO-X logger flatbuffer log base type.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
int8_t logPrioT
The type of the log priority code.
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
constexpr static logPrioT LOG_TELEM
A telemetry recording.
Message type for resolving log messages with a f.b. builder.
flatbuffers::FlatBufferBuilder builder
Base class for logs consisting of a flatbuffer message.
The type of the input message.
messageT(const double systemTime, const double lastOffset, const double rmsOffset, const double freq, const double residFreq, const double skew, const double rootDelay, const double rootDispersion, const double updateInt)
Construct from components.
Log entry recording the statistics from chrony.
static double rootDispersion(void *msgBuffer)
static void * getAccessor(const std::string &member)
Get pointer to the accessor for a member by name.
static const flatlogs::logPrioT defaultLevel
The default level.
static double skew(void *msgBuffer)
static double freq(void *msgBuffer)
static double lastOffset(void *msgBuffer)
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.
static double systemTime(void *msgBuffer)
static double rmsOffset(void *msgBuffer)
static double rootDelay(void *msgBuffer)
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatte for human consumption.
static double updateInt(void *msgBuffer)
static const flatlogs::eventCodeT eventCode
The event code.
static double residFreq(void *msgBuffer)