File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ static time_t const EPOCH_AT_COMPILE_TIME = cvt_time(__DATE__);
5151
5252TimeService::TimeService ()
5353: _con_hdl(nullptr )
54- #ifdef ARDUINO_ARCH_SAMD
54+ #if defined ( ARDUINO_ARCH_SAMD) || defined (ARDUINO_ARCH_MBED)
5555, _is_rtc_configured(false )
5656#endif
5757{
@@ -79,6 +79,13 @@ unsigned long TimeService::getTime()
7979 _is_rtc_configured = true ;
8080 }
8181 return rtc.getEpoch ();
82+ #elif ARDUINO_ARCH_MBED
83+ if (!_is_rtc_configured)
84+ {
85+ set_time (getRemoteTime ());
86+ _is_rtc_configured = true ;
87+ }
88+ return time (NULL );
8289#else
8390 return getRemoteTime ();
8491#endif
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ class TimeService
4646private:
4747
4848 ConnectionHandler * _con_hdl;
49- #ifdef ARDUINO_ARCH_SAMD
49+ #if defined ( ARDUINO_ARCH_SAMD) || defined (ARDUINO_ARCH_MBED)
5050 bool _is_rtc_configured;
5151#endif
5252
You can’t perform that action at this time.
0 commit comments