Fix uptime 17651+ days

5.12.0o
 * Fix NTP sync to Thu Jan 01 08:00:10 1970 results in uptime
17651+ days (core2.4.1/sdk2.2.1)
This commit is contained in:
Theo Arends 2018-04-30 14:18:46 +02:00
parent 040a7adaf1
commit 2c94ecfb6d
2 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
/* 5.12.0o
* Fix Energy Today and Yesterday overflow (#2543)
* Fix NTP sync to Thu Jan 01 08:00:10 1970 results in uptime 17651+ days (core2.4.1/sdk2.2.1)
*
* 5.12.0n
* Change ESP8266 Analog JSON message from {"Analog0:123"} to {"ANALOG":{"A0:123"}} to accomodate rules (#2560)

View File

@ -1314,7 +1314,7 @@ void RtcSecond()
uint8_t offset = (uptime < 30) ? RtcTime.second : (((ESP.getChipId() & 0xF) * 3) + 3) ; // First try ASAP to sync. If fails try once every 60 seconds based on chip id
if ((WL_CONNECTED == WiFi.status()) && (offset == RtcTime.second) && ((RtcTime.year < 2016) || (ntp_sync_minute == RtcTime.minute))) {
ntp_time = sntp_get_current_timestamp();
if (ntp_time) {
if (ntp_time > 1451602800) { // Fix NTP bug in core 2.4.1/SDK 2.2.1 (returns Thu Jan 01 08:00:10 1970 after power on)
utc_time = ntp_time;
ntp_sync_minute = 60; // Sync so block further requests
if (restart_time == 0) {