Remove an unnecessary define

This commit is contained in:
2022-12-25 13:14:11 +01:00
parent faac725069
commit 5d7844fdee

View File

@@ -25,7 +25,28 @@
#define NTP_PACKET_SIZE 48 // NTP time stamp is in the first 48 bytes of the message #define NTP_PACKET_SIZE 48 // NTP time stamp is in the first 48 bytes of the message
#define ntpFirstFourBytes 0xEC0600E3 // NTP request header, first 32 bits #define ntpFirstFourBytes 0xEC0600E3 // NTP request header, first 32 bits
#define UTC_DELTA ((UTC_DELTA_HOURS * NUMBEROFSECONDSPERHOUR) + (UTC_DELTA_MINUTES * NUMBEROFSECONDSPERMINUTE))
#define NTP_OFFSET_LI_VN_MODE 0
#define NTP_LI_MASK 0xC0
#define NTP_LI_NO_WARNING (0x00 << 6)
#define NTP_LI_LAST_MINUTE_61_SEC (0x01 << 6)
#define NTP_LI_LAST_MINUTE_59_SEC (0x02 << 6)
#define NTP_LI_ALARM_CONDITION (0x03 << 6) /* (clock not synchronized) */
#define NTP_VERSION_MASK 0x38
#define NTP_VERSION (4/* NTP Version 4*/<<3)
#define NTP_MODE_MASK 0x07
#define NTP_MODE_CLIENT 0x03
#define NTP_MODE_SERVER 0x04
#define NTP_MODE_BROADCAST 0x05
#define NTP_OFFSET_STRATUM 1
#define NTP_STRATUM_KOD 0x00
#define NTP_OFFSET_ORIGINATE_TIME 24
#define NTP_OFFSET_RECEIVE_TIME 32
#define NTP_OFFSET_TRANSMIT_TIME 40
typedef enum typedef enum
{ {
@@ -37,20 +58,21 @@ typedef enum
NTP_ERROR NTP_ERROR
} NTPState_t; } NTPState_t;
typedef struct PACK_STRUCT_BEGIN
{ typedef struct {
uint8_t li_vn_mode; PACK_STRUCT_FLD_8(uint8_t li_vn_mode);
uint8_t stratum; PACK_STRUCT_FLD_8(uint8_t stratum);
uint8_t poll; PACK_STRUCT_FLD_8(uint8_t poll);
uint8_t precesion; PACK_STRUCT_FLD_8(uint8_t precision);
uint32_t root_delay; PACK_STRUCT_FIELD(uint32_t root_delay);
uint32_t root_dispersion; PACK_STRUCT_FIELD(uint32_t root_dispersion);
uint32_t reference_identifier; PACK_STRUCT_FIELD(uint32_t reference_identifier);
uint32_t reference_timestamp[2]; PACK_STRUCT_FIELD(uint32_t reference_timestamp[2]);
uint32_t originate_timestamp[2]; PACK_STRUCT_FIELD(uint32_t originate_timestamp[2]);
uint32_t receive_timestamp[2]; PACK_STRUCT_FIELD(uint32_t receive_timestamp[2]);
uint32_t transmit_timestamp[2]; PACK_STRUCT_FIELD(uint32_t transmit_timestamp[2]);
} NTP_Packet; } NTP_Frame;
PACK_STRUCT_END
uint32_t NTPToEpochUnix(void); uint32_t NTPToEpochUnix(void);