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>{
146 static constexpr std::size_t
num_words();
170 struct timespec
atime() const;
204 inline constexpr std::size_t
215 "sizeof(RawFragmentHeader) is not an integer "
216 "multiple of sizeof(RawDataType)!");
221 if (utype < FIRST_USER_TYPE || utype > LAST_USER_TYPE)
223 throw cet::exception(
"InvalidValue")
224 <<
"RawFragmentHeader user types must be in the range of "
225 <<
static_cast<int>(FIRST_USER_TYPE) <<
" to " << static_cast<int>(LAST_USER_TYPE)
226 <<
" (bad type is " <<
static_cast<int>(utype) <<
").";
234 if (stype < FIRST_SYSTEM_TYPE /*|| stype > LAST_SYSTEM_TYPE*/)
236 throw cet::exception(
"InvalidValue")
237 <<
"RawFragmentHeader system types must be in the range of "
238 <<
static_cast<int>(FIRST_USER_TYPE) <<
" to " << static_cast<int>(LAST_USER_TYPE);
246 atime_ns = time.tv_nsec;
247 atime_s = time.tv_sec;
253 ts.tv_nsec = atime_ns;
260 auto a_time = atime();
263 a_time.tv_sec = time.tv_sec - a_time.tv_sec;
265 if (a_time.tv_nsec > time.tv_nsec)
268 a_time.tv_nsec = 1000000000 + time.tv_nsec - a_time.tv_nsec;
272 a_time.tv_nsec = time.tv_nsec - a_time.tv_nsec;
277 atime_ns = time.tv_nsec;
278 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)