Quicker restore to NTP when forced

Quicker restore to NTP when forced
This commit is contained in:
Theo Arends 2019-07-11 15:15:49 +02:00
parent c3d2937f22
commit c4dbde6306
1 changed files with 1 additions and 1 deletions

View File

@ -360,7 +360,7 @@ void RtcSecond(void)
if (!user_time_entry) {
if ((ntp_sync_minute > 59) && (RtcTime.minute > 2)) ntp_sync_minute = 1; // If sync prepare for a new cycle
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 (!global_state.wifi_down && (offset == RtcTime.second) && ((RtcTime.year < 2016) || (ntp_sync_minute == RtcTime.minute) || ntp_force_sync)) {
if (!global_state.wifi_down && (((offset == RtcTime.second) && ((RtcTime.year < 2016) || (ntp_sync_minute == RtcTime.minute))) || ntp_force_sync)) {
ntp_time = sntp_get_current_timestamp();
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)
ntp_force_sync = false;