From 43e6ec0cb673176945bdd6e2fd966c9f34e4f1f5 Mon Sep 17 00:00:00 2001 From: cyberman54 Date: Wed, 26 Jan 2022 14:57:35 +0100 Subject: [PATCH] if482.cpp: fixes after removal of eztime --- src/if482.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/if482.cpp b/src/if482.cpp index 37c12c38..81add69a 100644 --- a/src/if482.cpp +++ b/src/if482.cpp @@ -86,18 +86,19 @@ static const char TAG[] = __FILE__; 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) mon = 'M'; // time had been set but sync not completed else mon = 'A'; // time has been set and was recently synced - // generate IF482 telegram - // snprintf(out, sizeof(out), "O%cL%s\r", mon, myTZ.dateTime(t, UTC_TIME, - // "ymdwHis").c_str()); - - // ESP_LOGD(TAG, "[%s] IF482 date/time: %s", ctime(time(NULL), out); + // generate IF482 telegram for local time + struct tm tt; + localtime_r(&t, &tt); + mktime(&tt); + strftime(buf, sizeof(buf), "%y%m%d%u%H%M%S", &tt); + snprintf(out, sizeof(out), "O%cL%s\r", mon, buf); return out; }