coreSNTP v1.2.0
Client library for synchronizing device time with internet time using Simple Network Time Protocol (SNTP)
SntpResponseData_t Struct Reference

Structure representing data parsed from an SNTP response from server as well as data of arithmetic calculations derived from the response. More...

#include <core_sntp_serializer.h>

Data Fields

SntpTimestamp_t serverTime
 The timestamp sent by the server.
 
SntpLeapSecondInfo_t leapSecondType
 The information of an upcoming leap second in the server response.
 
uint32_t rejectedResponseCode
 If a server responded with Kiss-o'-Death message to reject time request, this is the fixed length ASCII code sequence for the rejection. More...
 
int64_t clockOffsetMs
 The offset (in milliseconds) of the system clock relative to the server time calculated from timestamps in the client SNTP request and server SNTP response packets. If the the system time is BEHIND the server time, then the clock-offset value is > 0. If the system time is AHEAD of the server time, then the clock-offset value is < 0. More...
 

Detailed Description

Structure representing data parsed from an SNTP response from server as well as data of arithmetic calculations derived from the response.

Field Documentation

◆ rejectedResponseCode

uint32_t SntpResponseData_t::rejectedResponseCode

If a server responded with Kiss-o'-Death message to reject time request, this is the fixed length ASCII code sequence for the rejection.

The Kiss-o'-Death code is always SNTP_KISS_OF_DEATH_CODE_LENGTH bytes long.

Note
If the server does not send a Kiss-o'-Death message in its response, this value will be SNTP_KISS_OF_DEATH_CODE_NONE.

◆ clockOffsetMs

int64_t SntpResponseData_t::clockOffsetMs

The offset (in milliseconds) of the system clock relative to the server time calculated from timestamps in the client SNTP request and server SNTP response packets. If the the system time is BEHIND the server time, then the clock-offset value is > 0. If the system time is AHEAD of the server time, then the clock-offset value is < 0.

Note
This information can be used to synchronize the system clock with a "slew", "step" OR combination of the two clock correction methodologies depending on the degree of system clock drift (represented by the clock-offset) and the application's tolerance for system clock error.
The library calculates the clock-offset value using the On-Wire protocol suggested by the NTPv4 specification. For more information, refer to https://tools.ietf.org/html/rfc5905#section-8.
The library ASSUMES that the server and client systems are within ~68 years of each other clock, whether in the same NTP era or across adjacent NTP eras. Thus, the client and system times MUST be within ~68 years (or 2^31 seconds exactly) of each other for correct calculation of clock-offset.
When the server and client times are exactly 2^31 (or INT32_MAX + 1 ) seconds apart, the library ASSUMES that the server time is ahead of the client time, and return the clock-offset value of INT32_MAX.

The documentation for this struct was generated from the following file: