Skip to content

Commit 38e56a6

Browse files
committed
TimeService: Add isConnected() function to check if ConnectionHandler Client is connected
1 parent 4ee7129 commit 38e56a6

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::isConnected()
196+
{
197+
if(_con_hdl == nullptr) {
198+
return false;
199+
} else {
200+
return _con_hdl->getClient().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 isConnected();
6768
static bool isTimeValid(unsigned long const time);
6869

6970
};

0 commit comments

Comments
 (0)