+ } else if (strcmp(action,"time") == 0) {
+ if(request->hasParam("timestamp")) {
+ unsigned long timestamp = atoi(request->getParam("timestamp")->value().c_str());
+ if (timestamp) {
+ timeval tv = { timestamp, 0 };
+ settimeofday(&tv, nullptr);
+ if (isRTCEnabled) {
+ Serial.println(F("Время установлено вручную"));
+ RTC.adjust(DateTime(timestamp));
+ }
+ }
+ request->send(200,"application/json", "{\"result\":\"OK\",\"message\":\"Устанавливаю время\"}");
+ } else {
+ request->send(500, "text/plain", "{\"result\":\"FAILED\",\"message\":\"Not all parameters set\"}");
+ }
+ } else {
+ request->send(500, "text/plain", "{\"result\":\"FAILED\",\"message\":\"Unsupported action\"}");