1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

lwip2 fixes and time/ntp management

core: +settimeofday()
core: +coredecls.h +sntp-lwip2.c
core: fix clock_gettime() with micros64()
core: honor DST in configTime()
core: internal clock is automatically started
examples: +esp8266/NTP-TZ-DST.ino
lwip2: sntp client removed
lwip2: fix crashing with WiFi.softAPConfig(ip,ip,ip)
fix #3852
This commit is contained in:
david gauchard
2017-11-14 22:34:43 +01:00
committed by Ivan Grokhotkov
parent 2f09ea7117
commit cbfbc1ad63
8 changed files with 607 additions and 15 deletions

View File

@ -27,7 +27,7 @@ author: d. gauchard
*/
// version for esp8266 sdk-2.0.0(656edbf)
// version for esp8266 sdk-2.0.0(656edbf) and later
#ifndef LWIP2_ARCH_CC_H
#define LWIP2_ARCH_CC_H
@ -48,12 +48,12 @@ extern "C"
#include "ets_sys.h"
#include "osapi.h"
#include "esp-missing.h"
#ifdef __cplusplus
}
#endif
void sntp_set_system_time (uint32_t t);
#ifdef __cplusplus
}
#endif
#endif // defined(LWIP_BUILD)
#include "mem.h" // useful for os_malloc used in esp-arduino's mDNS

View File

@ -2986,9 +2986,12 @@
--------------------------------------------------
*/
#define SNTP_SERVER_DNS 1 // SNTP support DNS names through sntp_setservername / sntp_getservername
#define SNTP_SERVER_ADDRESS "pool.ntp.org" // default
// if SNTP_SERVER_ADDRESS is defined, it always overrides user's config
// 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 1
#define SNTP_SET_SYSTEM_TIME(t) (sntp_set_system_time(t)) // implemented in lwip2-sntp.c
#define SNTP_SET_SYSTEM_TIME_US(t,us) do { struct timeval tv = { t, us }; settimeofday(&tv, NULL); } while (0)
/*
--------------------------------------------------
@ -2998,5 +3001,6 @@
#include "lwip/debug.h"
#include "arch/cc.h"
#include "lwip-git-hash.h"
#include <sys/time.h> // settimeofday() + struct timeval
#endif // MYLWIPOPTS_H