#632 - still experimental

This commit is contained in:
proddy
2020-12-29 22:15:59 +01:00
parent fd0b74055f
commit 7c6aeb3cb9
57 changed files with 1284 additions and 833 deletions

View File

@@ -70,7 +70,11 @@ void NTPSettingsService::configureTime(AsyncWebServerRequest * request, JsonVari
if (!sntp_enabled() && json.is<JsonObject>()) {
String timeUtc = json["time_utc"];
struct tm tm = {0};
char * s = strptime(timeUtc.c_str(), "%Y-%m-%dT%H:%M:%SZ", &tm);
// TODO fix strptime, which is not included in xtensa
// char * s = strptime(timeUtc.c_str(), "%Y-%m-%dT%H:%M:%SZ", &tm);
char * s = nullptr;
if (s != nullptr) {
time_t time = mktime(&tm);
struct timeval now = {.tv_sec = time};
@@ -80,6 +84,7 @@ void NTPSettingsService::configureTime(AsyncWebServerRequest * request, JsonVari
return;
}
}
AsyncWebServerResponse * response = request->beginResponse(400);
request->send(response);
}