File tree 1 file changed +17
-18
lines changed
1 file changed +17
-18
lines changed Original file line number Diff line number Diff line change @@ -206,27 +206,26 @@ unsigned long TimeService::getRemoteTime()
206
206
#include " ../../AIoTC_Config.h"
207
207
#ifndef HAS_LORA
208
208
209
- if (_con_hdl == nullptr )
210
- return EPOCH_AT_COMPILE_TIME;
211
-
212
- /* At first try to see if a valid time can be obtained
213
- * using the network time available via the connection
214
- * handler.
215
- */
216
- unsigned long const connection_time = _con_hdl->getTime ();
217
- if (isTimeValid (connection_time)) {
218
- return connection_time;
219
- }
209
+ if (connected ()) {
210
+ /* At first try to see if a valid time can be obtained
211
+ * using the network time available via the connection
212
+ * handler.
213
+ */
214
+ unsigned long const connection_time = _con_hdl->getTime ();
215
+ if (isTimeValid (connection_time)) {
216
+ return connection_time;
217
+ }
220
218
221
219
#ifndef __AVR__
222
- /* If no valid network time is available try to obtain the
223
- * time via NTP next.
224
- */
225
- unsigned long const ntp_time = NTPUtils::getTime (_con_hdl->getUDP ());
226
- if (isTimeValid (ntp_time)) {
227
- return ntp_time;
228
- }
220
+ /* If no valid network time is available try to obtain the
221
+ * time via NTP next.
222
+ */
223
+ unsigned long const ntp_time = NTPUtils::getTime (_con_hdl->getUDP ());
224
+ if (isTimeValid (ntp_time)) {
225
+ return ntp_time;
226
+ }
229
227
#endif
228
+ }
230
229
231
230
#endif /* ifndef HAS_LORA */
232
231
You can’t perform that action at this time.
0 commit comments