Skip to content

Commit 956de5a

Browse files
committed
TimeService: Add connected() method to check connection status
1 parent 451d57d commit 956de5a

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/utility/time/TimeService.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ unsigned long TimeService::getTimeFromString(const String& input)
192192
* PRIVATE MEMBER FUNCTIONS
193193
**************************************************************************************/
194194

195+
bool TimeService::connected()
196+
{
197+
if(_con_hdl == nullptr) {
198+
return false;
199+
} else {
200+
return _con_hdl->getStatus() == NetworkConnectionState::CONNECTED;
201+
}
202+
}
203+
195204
unsigned long TimeService::getRemoteTime()
196205
{
197206
#include "../../AIoTC_Config.h"

src/utility/time/TimeService.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class TimeService
6464
unsigned long _timezone_dst_until;
6565

6666
unsigned long getRemoteTime();
67+
bool connected();
6768
static bool isTimeValid(unsigned long const time);
6869

6970
};

0 commit comments

Comments
 (0)