EPICS Base  7.0.6.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
epicsNtp.h
1 /*************************************************************************\
2 * (C) 2014 David Lettier.
3 * http://www.lettier.com/
4 * SPDX-License-Identifier: BSD-3-Clause
5 \*************************************************************************/
6 #ifndef EPICSNTP_H
7 #define EPICSNTP_H
8 
9 #define NTP_TIMESTAMP_DELTA 2208988800ull
10 
11 int epicsNtpGetTime(char *ntpIp, struct timespec *now);
12 
13 typedef struct
14 {
15 
16  uint8_t li_vn_mode; // Eight bits. li, vn, and mode.
17  // li. Two bits. Leap indicator.
18  // vn. Three bits. Version number of the protocol.
19  // mode. Three bits. Client will pick mode 3 for client.
20 
21  uint8_t stratum; // Eight bits. Stratum level of the local clock.
22  uint8_t poll; // Eight bits. Maximum interval between successive messages.
23  uint8_t precision; // Eight bits. Precision of the local clock.
24 
25  uint32_t rootDelay; // 32 bits. Total round trip delay time.
26  uint32_t rootDispersion; // 32 bits. Max error aloud from primary clock source.
27  uint32_t refId; // 32 bits. Reference clock identifier.
28 
29  uint32_t refTm_s; // 32 bits. Reference time-stamp seconds.
30  uint32_t refTm_f; // 32 bits. Reference time-stamp fraction of a second.
31 
32  uint32_t origTm_s; // 32 bits. Originate time-stamp seconds.
33  uint32_t origTm_f; // 32 bits. Originate time-stamp fraction of a second.
34 
35  uint32_t rxTm_s; // 32 bits. Received time-stamp seconds.
36  uint32_t rxTm_f; // 32 bits. Received time-stamp fraction of a second.
37 
38  uint32_t txTm_s; // 32 bits and the most important field the client cares about. Transmit time-stamp seconds.
39  uint32_t txTm_f; // 32 bits. Transmit time-stamp fraction of a second.
40 
41 } ntp_packet; // Total: 384 bits or 48 bytes.
42 #endif // EPICSNTP_H
Defined by POSIX Real Time.