if482.cpp: fixes after removal of eztime

This commit is contained in:
cyberman54 2022-01-26 14:57:35 +01:00
parent 529059edf4
commit 43e6ec0cb6

View File

@ -86,18 +86,19 @@ static const char TAG[] = __FILE__;
String IF482_Frame(time_t t) { String IF482_Frame(time_t t) {
char mon, out[IF482_FRAME_SIZE + 1]; char mon, out[IF482_FRAME_SIZE + 1], buf[IF482_FRAME_SIZE - 3];
if (sntp_get_sync_status() == SNTP_SYNC_STATUS_IN_PROGRESS) if (sntp_get_sync_status() == SNTP_SYNC_STATUS_IN_PROGRESS)
mon = 'M'; // time had been set but sync not completed mon = 'M'; // time had been set but sync not completed
else else
mon = 'A'; // time has been set and was recently synced mon = 'A'; // time has been set and was recently synced
// generate IF482 telegram // generate IF482 telegram for local time
// snprintf(out, sizeof(out), "O%cL%s\r", mon, myTZ.dateTime(t, UTC_TIME, struct tm tt;
// "ymdwHis").c_str()); localtime_r(&t, &tt);
mktime(&tt);
// ESP_LOGD(TAG, "[%s] IF482 date/time: %s", ctime(time(NULL), out); strftime(buf, sizeof(buf), "%y%m%d%u%H%M%S", &tt);
snprintf(out, sizeof(out), "O%cL%s\r", mon, buf);
return out; return out;
} }