Compare commits
1 commit
master
...
sntp-exten
Author | SHA1 | Date | |
---|---|---|---|
4df0599374 |
|
@ -198,6 +198,19 @@ static ip_addr_t sntp_last_server_address;
|
||||||
static u32_t sntp_last_timestamp_sent[2];
|
static u32_t sntp_last_timestamp_sent[2];
|
||||||
#endif /* SNTP_CHECK_RESPONSE >= 2 */
|
#endif /* SNTP_CHECK_RESPONSE >= 2 */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Weak callbacks to implement setting system time
|
||||||
|
*/
|
||||||
|
extern void __attribute__((weak)) sntp_setsystemtime_us(u32_t t, u32_t us)
|
||||||
|
{
|
||||||
|
SNTP_SET_SYSTEM_TIME_US(t, us);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void __attribute__((weak)) sntp_setsystemtime(u32_t t)
|
||||||
|
{
|
||||||
|
SNTP_SET_SYSTEM_TIME(t);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SNTP processing of received timestamp
|
* SNTP processing of received timestamp
|
||||||
*/
|
*/
|
||||||
|
@ -214,14 +227,14 @@ sntp_process(u32_t *receive_timestamp)
|
||||||
|
|
||||||
#if SNTP_CALC_TIME_US
|
#if SNTP_CALC_TIME_US
|
||||||
u32_t us = ntohl(receive_timestamp[1]) / 4295;
|
u32_t us = ntohl(receive_timestamp[1]) / 4295;
|
||||||
SNTP_SET_SYSTEM_TIME_US(t, us);
|
sntp_setsystemtime_us(t, us);
|
||||||
/* display local time from GMT time */
|
/* display local time from GMT time */
|
||||||
LWIP_DEBUGF(SNTP_DEBUG_TRACE, ("sntp_process: %s, %"U32_F" us", ctime(&tim), us));
|
LWIP_DEBUGF(SNTP_DEBUG_TRACE, ("sntp_process: %s, %"U32_F" us", ctime(&tim), us));
|
||||||
|
|
||||||
#else /* SNTP_CALC_TIME_US */
|
#else /* SNTP_CALC_TIME_US */
|
||||||
|
|
||||||
/* change system time and/or the update the RTC clock */
|
/* change system time and/or the update the RTC clock */
|
||||||
SNTP_SET_SYSTEM_TIME(t);
|
sntp_setsystemtime(t);
|
||||||
/* display local time from GMT time */
|
/* display local time from GMT time */
|
||||||
|
|
||||||
LWIP_DEBUGF(SNTP_DEBUG_TRACE, ("sntp_process: %s", ctime(&tim)));
|
LWIP_DEBUGF(SNTP_DEBUG_TRACE, ("sntp_process: %s", ctime(&tim)));
|
||||||
|
|
Loading…
Reference in a new issue