From 1e9d38c17897904b9108c3b06bc9ddaa367c2b34 Mon Sep 17 00:00:00 2001 From: pennam Date: Wed, 17 Jul 2024 15:25:25 +0200 Subject: [PATCH] If available force network time sync when connecting or reconnecting --- src/ArduinoIoTCloudTCP.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ArduinoIoTCloudTCP.cpp b/src/ArduinoIoTCloudTCP.cpp index f2a1b6fc..8c74a32a 100644 --- a/src/ArduinoIoTCloudTCP.cpp +++ b/src/ArduinoIoTCloudTCP.cpp @@ -267,7 +267,8 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConnectPhy() ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_SyncTime() { - if (TimeServiceClass::isTimeValid(getTime())) + /* If available force network time sync when connecting or reconnecting */ + if (_time_service.sync()) { DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s internal clock configured to posix timestamp %d", __FUNCTION__, getTime()); return State::ConnectMqttBroker;