try to fix #408 and #412

This commit is contained in:
MichaelDvP
2022-03-29 15:30:39 +02:00
parent 80c87c8c43
commit 786a94b448
6 changed files with 33 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
#include <NTPStatus.h>
#include "../../src/emsesp_stub.hpp" // proddy added
using namespace std::placeholders; // for `_1` etc
@@ -35,7 +36,7 @@ void NTPStatus::ntpStatus(AsyncWebServerRequest * request) {
time_t now = time(nullptr);
// only provide enabled/disabled status for now
root["status"] = sntp_enabled() ? 1 : 0;
root["status"] = sntp_enabled() && emsesp::EMSESP::system_.ntp_connected() ? 1 : 0;
// the current time in UTC
root["utc_time"] = toUTCTimeString(gmtime(&now));