34#define NTP_LEAP_INDICATOR_OFFSET 6U
39#define NTP_VERSION_OFFSET 3U
44#define NTP_MODE_OFFSET 0U
50#define NTP_POLL_TO_SECONDS(poll) (1U << poll)
uint32_t unixToNTPTime(time_t unixTime)
Converts a Unix time to NTP time.
Definition: network_time_protocol.cc:24
void dumpNTPPacketData(const NTPPacket packet)
Dumps the data of an NTP packet for debugging purposes.
Definition: network_time_protocol.cc:33
void convertNTPTimestamp(NTPTime ×tamp)
Converts an NTP timestamp to its human-readable representation.
Definition: network_time_protocol.cc:28
NTPLeapIndicator
Enumeration for the Leap Indicator values.
Definition: network_time_protocol.h:99
time_t ntpToUnixTime(NTPTime ntpTime)
Converts an NTP time to Unix time.
NTPMode
Enumeration for the NTP modes.
Definition: network_time_protocol.h:85
static constexpr uint32_t NTP_UNIX_EPOCH_DIFF
Difference between the NTP epoch (1900-01-01) and the Unix epoch (1970-01-01) in seconds.
Definition: network_time_protocol.h:55
@ NTP_LI_NONE
Definition: network_time_protocol.h:100
@ NTP_LI_LAST_MINUTE_OF_THE_DAY_61_S
Definition: network_time_protocol.h:101
@ NTP_LI_NOSYNC
Definition: network_time_protocol.h:103
@ NTP_LI_LAST_MINUTE_OF_THE_DAY_59_S
Definition: network_time_protocol.h:102
@ NUM_NTP_MODES
Definition: network_time_protocol.h:93
@ NTP_RESERVED_MODE
Definition: network_time_protocol.h:86
@ NTP_CLIENT_MODE
Definition: network_time_protocol.h:89
@ NTP_CONTROL_MODE
Definition: network_time_protocol.h:92
@ NTP_ACTIVE_MODE
Definition: network_time_protocol.h:87
@ NTP_PASSIVE_MODE
Definition: network_time_protocol.h:88
@ NTP_SERVER_MODE
Definition: network_time_protocol.h:90
@ NTP_BROADCAST_MODE
Definition: network_time_protocol.h:91
Structure representing an NTP packet.
Definition: network_time_protocol.h:68
NTPTime originTime
Definition: network_time_protocol.h:77
uint32_t rootDispersion
Definition: network_time_protocol.h:74
uint8_t poll
Definition: network_time_protocol.h:71
uint32_t rootDelay
Definition: network_time_protocol.h:73
NTPTime receiveTime
Definition: network_time_protocol.h:78
NTPTime transmitTime
Definition: network_time_protocol.h:79
uint8_t flags
Definition: network_time_protocol.h:69
uint8_t referenceId[4]
Definition: network_time_protocol.h:75
uint8_t precision
Definition: network_time_protocol.h:72
uint8_t stratum
Definition: network_time_protocol.h:70
NTPTime referenceTime
Definition: network_time_protocol.h:76
Structure representing NTP time format with seconds and fractional seconds.
Definition: network_time_protocol.h:60
uint32_t seconds
Definition: network_time_protocol.h:61
uint32_t fraction
Definition: network_time_protocol.h:62