diff --git a/sonoff/_releasenotes.ino b/sonoff/_releasenotes.ino index 804fc4068..0cb14f97b 100644 --- a/sonoff/_releasenotes.ino +++ b/sonoff/_releasenotes.ino @@ -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) diff --git a/sonoff/support.ino b/sonoff/support.ino index 78ac10c0c..a33c81a1a 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -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) {