From fbfd79241650f7caef4983d5e669acb97ddaf129 Mon Sep 17 00:00:00 2001 From: Proddy Date: Thu, 12 Jan 2023 17:39:07 +0100 Subject: [PATCH] add back TZ to syslog --- lib/uuid-syslog/src/syslog.cpp | 44 ++++++++++++++++------------------ 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/lib/uuid-syslog/src/syslog.cpp b/lib/uuid-syslog/src/syslog.cpp index 5b12cb2f3..70fbe6318 100644 --- a/lib/uuid-syslog/src/syslog.cpp +++ b/lib/uuid-syslog/src/syslog.cpp @@ -324,7 +324,7 @@ void SyslogService::loop() { } bool SyslogService::can_transmit() { - // TODO add this like in v3.5? + // TODO removed this, it was in 720 ? diff - 1440 : diff < -720 ? diff + 1440 : diff; - // From previous EMS-ESP. Need to check if still needed. - // tzh = diff / 60; - // tzm = diff < 0 ? (0 - diff) % 60 : diff % 60; + // added for EMS-ESP + tzh = diff / 60; + tzm = diff < 0 ? (0 - diff) % 60 : diff % 60; } if (udp_.beginPacket(ip_, port_) != 1) { @@ -494,31 +493,30 @@ bool SyslogService::transmit(const QueuedLogMessage & message) { udp_.printf("<%u>1 ", (uint8_t)(message.content_->facility * 8U) + std::min(7U, (unsigned int)message.content_->level)); if (tm.tm_year != 0) { - udp_.printf_P("%04u-%02u-%02uT%02u:%02u:%02u.%06luZ", - tm.tm_year + 1900, - tm.tm_mon + 1, - tm.tm_mday, - tm.tm_hour, - tm.tm_min, - tm.tm_sec, - (unsigned long)message.time_.tv_usec); - - // udp_.printf("%04u-%02u-%02uT%02u:%02u:%02u.%06u%+02d:%02d", + // udp_.printf_P("%04u-%02u-%02uT%02u:%02u:%02u.%06luZ", // tm.tm_year + 1900, // tm.tm_mon + 1, // tm.tm_mday, // tm.tm_hour, // tm.tm_min, // tm.tm_sec, - // (unsigned long)message.time_.tv_usec, - // tzh, - // tzm); + // (unsigned long)message.time_.tv_usec); + + // added for EMS-ESP + udp_.printf("%04u-%02u-%02uT%02u:%02u:%02u.%06lu%+02d:%02d", + tm.tm_year + 1900, + tm.tm_mon + 1, + tm.tm_mday, + tm.tm_hour, + tm.tm_min, + tm.tm_sec, + (unsigned long)message.time_.tv_usec, + tzh, + tzm); } else { udp_.print('-'); } - // Changes for EMS-ESP by MichaelDvP - udp_.printf_P(PSTR(" %s %s - - - "), hostname_.c_str(), (message.content_->name)); char id_c_str[15];