9#ifndef DFMESSAGES_INCLUDE_DFMESSAGES_TIMESYNC_HPP_
10#define DFMESSAGES_INCLUDE_DFMESSAGES_TIMESYNC_HPP_
58 gettimeofday(&tv,
nullptr);
59 return static_cast<system_time_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
64static_assert(
sizeof(
TimeSync) == 32,
"TimeSync size unexpected!");
65static_assert(offsetof(
TimeSync, daq_time) == 0,
"TimeSync daq_time field not at expected offset!");
66static_assert(offsetof(
TimeSync, system_time) == 8,
"TimeSync system_time field not at expected offset!");
67static_assert(offsetof(
TimeSync, sequence_number) == 16,
"TimeSync sequence_number field not at expected offset!");
68static_assert(offsetof(
TimeSync, run_number) == 24,
"TimeSync run_number field not at expected offset!");
69static_assert(offsetof(
TimeSync, source_pid) == 28,
"TimeSync source_pid field not at expected offset!");
#define DUNE_DAQ_SERIALIZABLE(Type, typestring)
static constexpr system_time_t s_invalid_system_time
An invalid system time.
daqdataformats::run_number_t run_number_t
Copy daqdataformats::run_number_t.
daqdataformats::timestamp_t timestamp_t
Copy daqdataformats::timestamp_t.
uint64_t system_time_t
System times are represented using a 64-bit unsigned integer This number is defined as the number of ...
A synthetic message used to ensure that all elements of a DAQ system are synchronized.
timestamp_t daq_time
The current DAQ time.
run_number_t run_number
Run number at time of creation.
TimeSync(timestamp_t daq_time, system_time_t sys_time=gettimeofday_us())
Construct a TimeSync message.
DUNE_DAQ_SERIALIZE(TimeSync, daq_time, system_time, run_number, sequence_number, source_pid)
uint64_t sequence_number
Sequence Number of this message, for debugging.
static system_time_t gettimeofday_us()
Get the current system time.
uint32_t source_pid
PID of the creating process, for debugging.
system_time_t system_time
The current system time.