@@ -76,7 +76,8 @@ time_t ntpClient::getTime() {
76
76
client->_udp .stop ();
77
77
client->_lastSyncd = timeValue;
78
78
#ifdef DEBUG
79
- Serial.printf (" Succeccful NTP sync at %s" , client->getTimeString (client->_lastSyncd ));
79
+ Serial.println (" Succeccful NTP sync at " );
80
+ Serial.println (client->getTimeString (client->_lastSyncd ));
80
81
#endif // DEBUG
81
82
return timeValue;
82
83
}
@@ -85,6 +86,7 @@ time_t ntpClient::getTime() {
85
86
Serial.println (" -- No NTP Response :-(" );
86
87
#endif // DEBUG
87
88
client->_udp .stop ();
89
+ setSyncInterval (client->_shortInterval ); // Retry connection more often
88
90
89
91
return 0 ; // return 0 if unable to get the time
90
92
}
@@ -151,7 +153,8 @@ time_t ntpClient::getTime() {
151
153
client->_udp .stop ();
152
154
client->_lastSyncd = timeValue;
153
155
#ifdef DEBUG
154
- Serial.printf (" Succeccful NTP sync at %s" , client->getTimeString (client->_lastSyncd ));
156
+ Serial.println (" Succeccful NTP sync at " );
157
+ Serial.println (client->getTimeString (client->_lastSyncd ));
155
158
#endif // DEBUG
156
159
return timeValue;
157
160
}
@@ -160,7 +163,7 @@ time_t ntpClient::getTime() {
160
163
Serial.println (" -- No NTP Response :-(" );
161
164
#endif // DEBUG
162
165
client->_udp .stop ();
163
-
166
+ setSyncInterval (client-> _shortInterval ); // Retry connection more often
164
167
return 0 ; // return 0 if unable to get the time
165
168
}
166
169
else {
@@ -322,13 +325,21 @@ time_t ntpClient::decodeNtpMessage(byte *messageBuffer) {
322
325
timeTemp += SECS_PER_HOUR;
323
326
#ifdef DEBUG
324
327
Serial.println (" Summer Time" );
328
+ #endif // DEBUG
325
329
}
330
+ #ifdef DEBUG
326
331
else {
327
332
Serial.println (" Winter Time" );
328
- #endif // DEBUG
329
333
}
334
+ #endif // DEBUG
330
335
}
336
+ #ifdef DEBUG
337
+
338
+ else {
339
+ Serial.println (" No daylight" );
331
340
341
+ }
342
+ #endif // DEBUG
332
343
return timeTemp;
333
344
}
334
345
@@ -511,7 +522,12 @@ boolean ntpClient::setTimeZone(int timeZone)
511
522
512
523
void ntpClient::setDayLight (boolean daylight )
513
524
{
514
- this ->_daylight = daylight ;
525
+ _daylight = daylight ;
526
+ #ifdef DEBUG
527
+ Serial.print (" --Set daylight saving to " );
528
+ Serial.println (daylight );
529
+
530
+ #endif // DEBUG
515
531
}
516
532
517
533
//
0 commit comments