mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
shower time with timezone
This commit is contained in:
@@ -107,8 +107,8 @@ void Shower::loop() {
|
|||||||
time_t now = time(nullptr);
|
time_t now = time(nullptr);
|
||||||
if (now > 1576800000) { // year 2020
|
if (now > 1576800000) { // year 2020
|
||||||
tm * tm_ = localtime(&now);
|
tm * tm_ = localtime(&now);
|
||||||
char dt[20];
|
char dt[25];
|
||||||
strftime(dt, sizeof(dt), "%T", tm_);
|
strftime(dt, sizeof(dt), "%FT%T%z", tm_);
|
||||||
doc["time"] = dt;
|
doc["time"] = dt;
|
||||||
}
|
}
|
||||||
Mqtt::queue_publish("shower_data", doc.as<JsonObject>());
|
Mqtt::queue_publish("shower_data", doc.as<JsonObject>());
|
||||||
|
|||||||
Reference in New Issue
Block a user