mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
time: import IANA timezone definitions, expose SNTP API (#6373)
* time: import IANA timezone definitions - `configTime("timezone", "ntp servers...")` added - timezone definitions by country/cities (TZ.h) - script to update timezone definitions - updated example * fix former configTime non-matching signature * +include * example: add scheduled function in callback * crlf fix * +missing license for napt * SNTP: expose configuration helpers * update submodule * update precompiled libraries * optional: change SNTP startup delay * makes SNTP_UPDATE_DELAY a weak function update example fix for lwip1.4 * on the proper use of polledTimeout api... thanks @mcspr :] * improve update script (per review) * update lwIP submodule * update submodule * hide harmless shell message * update the release process by asking first to update TZ.h [ci skip] * minor update in release documentation * update in release documentation * update in release documentation * clarify release documentation * fix release documentation - sorry for the noise :( * fixes per review * example style * useless variable in example * update lwip2 submodule reference, to include espressif missing declaration fixes
This commit is contained in:
@ -3545,6 +3545,9 @@
|
||||
#error LWIP_FEATURES must be defined
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TCP_RANDOM_PORT: randomize port instead of simply increasing
|
||||
@ -3561,27 +3564,34 @@
|
||||
// so we do not define it. sntp server can come from dhcp server, or by
|
||||
// user.
|
||||
//#define SNTP_SERVER_ADDRESS "pool.ntp.org" // default
|
||||
//#define SNTP_GET_SERVERS_FROM_DHCP // implicitely enabled by LWIP_DHCP_GET_NTP_SRV
|
||||
//#define SNTP_GET_SERVERS_FROM_DHCP // implicitely enabled by LWIP_DHCP_GET_NTP_SRV
|
||||
|
||||
#define SNTP_SERVER_DNS 1 // enable SNTP support DNS names through sntp_setservername / sntp_getservername
|
||||
#define SNTP_SERVER_DNS 1 // enable SNTP support DNS names through sntp_setservername / sntp_getservername
|
||||
|
||||
#define SNTP_SET_SYSTEM_TIME_US(t,us) do { struct timeval tv = { t, us }; settimeofday(&tv, NULL); } while (0)
|
||||
|
||||
#define SNTP_SUPPRESS_DELAY_CHECK 1
|
||||
#define SNTP_UPDATE_DELAY_DEFAULT 3600000 // update delay defined by a default weak function
|
||||
#define SNTP_UPDATE_DELAY sntp_update_delay_MS_rfc_not_less_than_15000()
|
||||
extern uint32_t SNTP_UPDATE_DELAY;
|
||||
|
||||
#if LWIP_FEATURES
|
||||
// lwip-1.4 had 3 possible SNTP servers (constant was harcoded)
|
||||
// esp8266/arduino/lwip-1.4 had 3 possible SNTP servers (constant was harcoded)
|
||||
#define SNTP_MAX_SERVERS 3
|
||||
#endif
|
||||
|
||||
// turn off random delay before sntp request
|
||||
// when SNTP_STARTUP_DELAY is not defined,
|
||||
// LWIP_RAND is used to set a delay
|
||||
// no delay by default before sntp request
|
||||
// https://github.com/esp8266/Arduino/pull/5564
|
||||
// from sntp_opts.h:
|
||||
/** According to the RFC, this shall be a random delay
|
||||
* between 1 and 5 minutes (in milliseconds) to prevent load peaks.
|
||||
* This can be defined to a random generation function,
|
||||
* which must return the delay in milliseconds as u32_t.
|
||||
*/
|
||||
#define SNTP_STARTUP_DELAY 0
|
||||
#define SNTP_STARTUP_DELAY 1 // enable startup delay
|
||||
#define SNTP_STARTUP_DELAY_FUNC_DEFAULT 0 // to 0 by default via a default weak function
|
||||
#define SNTP_STARTUP_DELAY_FUNC sntp_startup_delay_MS_rfc_not_less_than_60000()
|
||||
extern uint32_t SNTP_STARTUP_DELAY_FUNC;
|
||||
|
||||
/*
|
||||
--------------------------------------------------
|
||||
@ -3633,4 +3643,8 @@ void tcp_kill_timewait (void);
|
||||
#define MEMP_NUM_TCP_PCB_TIME_WAIT 5
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // MYLWIPOPTS_H
|
||||
|
Reference in New Issue
Block a user