mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-18 08:11:55 +01:00
Added a timeout of 5ms to detect current time.
This prevents false positives when a interrupt occours during the reading of the time
This commit is contained in:
@@ -38,7 +38,7 @@ void WebApiNtpClass::onNtpStatus(AsyncWebServerRequest* request)
|
||||
root[F("ntp_timezone_descr")] = config.Ntp_TimezoneDescr;
|
||||
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 0)) {
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
root[F("ntp_status")] = false;
|
||||
} else {
|
||||
root[F("ntp_status")] = true;
|
||||
@@ -159,7 +159,7 @@ void WebApiNtpClass::onNtpTimeGet(AsyncWebServerRequest* request)
|
||||
JsonObject root = response->getRoot();
|
||||
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 0)) {
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
root[F("ntp_status")] = false;
|
||||
} else {
|
||||
root[F("ntp_status")] = true;
|
||||
|
||||
Reference in New Issue
Block a user