@@ -743,12 +743,12 @@ time_t periodic_timesync;
743
743
// MQTT SSL requires a relatively accurate time between broker and client
744
744
void SetTimeESP32 () {
745
745
time_t now = time (nullptr );
746
- Serial.print (" Before time sync : " );
747
- Serial.println (ctime (&now));
746
+ Serial.print (" Before time sync: " );
747
+ Serial.print (ctime (&now));
748
748
749
749
// Set time from NTP servers
750
750
configTime (TZ_OFFSET * 3600 , TZ_DST * 60 , " time.nist.gov" , " pool.ntp.org" );
751
- Serial.println ( " \n Waiting for time" );
751
+ Serial.print ( " Waiting for time" );
752
752
while (time (nullptr ) <= 100000 ) {
753
753
NeoPixelStatus ( LED_FIRMWARE_DFU ); // blink yellow
754
754
Serial.print (" ." );
@@ -757,17 +757,17 @@ void SetTimeESP32() {
757
757
unsigned timeout = 5000 ;
758
758
unsigned start = millis ();
759
759
while (millis () - start < timeout) {
760
- time_t now = time (nullptr );
760
+ now = time (nullptr );
761
761
if (now > (2019 - 1970 ) * 365 * 24 * 3600 ) {
762
762
break ;
763
763
}
764
764
delay (100 );
765
765
}
766
766
delay (1000 ); // Wait for time to fully sync
767
767
768
- Serial.print (" After time sync: " );
768
+ Serial.print (" \n After time sync : " );
769
769
now = time (nullptr );
770
- Serial.println (ctime (&now));
770
+ Serial.print (ctime (&now));
771
771
periodic_timesync = now; // periodically resync the time to prevent drift
772
772
}
773
773
0 commit comments