Working version

This commit is contained in:
Dmitry Borisenko
2020-11-15 02:46:27 +03:00
parent d6aab0cf94
commit 94d93d3be6
14 changed files with 58 additions and 111 deletions

View File

@@ -1,5 +1,5 @@
#include "Utils/TimeUtils.h"
#include "Global.h"
#include "Utils/StringUtils.h"
static const uint8_t days_in_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
@@ -211,3 +211,17 @@ void breakEpochToTime(unsigned long epoch, Time_t& tm) {
tm.day_of_month = time + 1; // day of month
tm.valid = (epoch > MIN_DATETIME);
}
void handle_time_init() {
ts.add(
TIME, 1000, [&](void*) {
String timenow = timeNow->getTimeWOsec();
static String prevTime;
if (prevTime != timenow) {
prevTime = timenow;
jsonWriteStr(configLiveJson, "timenow", timenow);
eventGen2("timenow", timenow);
}
},
nullptr, true);
}