1 #ifndef artdaq_core_Data_detail_RawFragmentHeader_hh
2 #define artdaq_core_Data_detail_RawFragmentHeader_hh
10 #include "artdaq-core/Data/dictionarycontrol.hh"
11 #include "artdaq-core/Utilities/TimeUtils.hh"
12 #include "cetlib_except/exception.h"
72 return std::map<type_t, std::string>{
86 return std::map<type_t, std::string>{
117 return "EndOfSubrun";
162 static constexpr std::size_t
num_words();
186 struct timespec
atime() const;
220 inline constexpr std::size_t
231 "sizeof(RawFragmentHeader) is not an integer "
232 "multiple of sizeof(RawDataType)!");
237 if (utype < FIRST_USER_TYPE || utype > LAST_USER_TYPE)
239 throw cet::exception(
"InvalidValue")
240 <<
"RawFragmentHeader user types must be in the range of "
241 <<
static_cast<int>(FIRST_USER_TYPE) <<
" to " << static_cast<int>(LAST_USER_TYPE)
242 <<
" (bad type is " <<
static_cast<int>(utype) <<
").";
250 if (stype < FIRST_SYSTEM_TYPE /*|| stype > LAST_SYSTEM_TYPE*/)
252 throw cet::exception(
"InvalidValue")
253 <<
"RawFragmentHeader system types must be in the range of "
254 <<
static_cast<int>(FIRST_USER_TYPE) <<
" to " << static_cast<int>(LAST_USER_TYPE);
262 atime_ns = time.tv_nsec;
263 atime_s = time.tv_sec;
269 ts.tv_nsec = atime_ns;
276 auto a_time = atime();
279 a_time.tv_sec = time.tv_sec - a_time.tv_sec;
281 if (a_time.tv_nsec > time.tv_nsec)
284 a_time.tv_nsec = 1000000000 + time.tv_nsec - a_time.tv_nsec;
288 a_time.tv_nsec = time.tv_nsec - a_time.tv_nsec;
293 atime_ns = time.tv_nsec;
294 atime_s = time.tv_sec;
struct timespec get_realtime_clock()
Get the current time of day as a pair of seconds and nanoseconds (from clock_gettime(CLOCK_REALTIME, ...) system call)