File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -279,24 +279,24 @@ bool TimeServiceClass::connected()
279
279
unsigned long TimeServiceClass::getRemoteTime ()
280
280
{
281
281
if (connected ()) {
282
- /* At first try to see if a valid time can be obtained
283
- * using the network time available via the connection
284
- * handler.
285
- */
286
- unsigned long const connection_time = _con_hdl->getTime ();
287
- if (isTimeValid (connection_time)) {
288
- return connection_time;
289
- }
290
-
291
282
#ifndef __AVR__
292
- /* If no valid network time is available try to obtain the
293
- * time via NTP next.
283
+ /* At first try to obtain a valid time via NTP.
284
+ * This is the most reliable time source and it will
285
+ * ensure a correct behaviour of the library.
294
286
*/
295
287
unsigned long const ntp_time = NTPUtils::getTime (_con_hdl->getUDP ());
296
288
if (isTimeValid (ntp_time)) {
297
289
return ntp_time;
298
290
}
299
291
#endif
292
+
293
+ /* As fallback if NTP request fails try to obtain the
294
+ * network time using the connection handler.
295
+ */
296
+ unsigned long const connection_time = _con_hdl->getTime ();
297
+ if (isTimeValid (connection_time)) {
298
+ return connection_time;
299
+ }
300
300
}
301
301
302
302
/* Return the epoch timestamp at compile time as a last
You can’t perform that action at this time.
0 commit comments