add seconds since epoch to datetime struct

This commit is contained in:
2021-02-07 18:35:10 +01:00
parent 27f646860d
commit 0957fc4830
2 changed files with 9 additions and 4 deletions

View File

@ -56,6 +56,7 @@ typedef struct _datetime
uint8_t hh;
uint8_t mm;
uint8_t ss;
uint64_t seconds;
} datetime;
#define ntp_port 123 //ntp server port number
@ -63,7 +64,7 @@ typedef struct _datetime
#define UTC_ADJ_HRS 9 // SEOUL : GMT+9
#define EPOCH 1900 // NTP start year
void get_seconds_from_ntp_server(uint8_t *buf, uint16_t idx);
uint64_t get_seconds_from_ntp_server(uint8_t *buf, uint16_t idx);
void SNTP_init(uint8_t s, uint8_t *ntp_server, uint8_t tz, uint8_t *buf);
int8_t SNTP_run(datetime *time);
tstamp changedatetime_to_seconds(void);