From 1549250ed662bd821e431332074e79202ced06fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Sun, 15 Jan 2023 12:21:40 +0100 Subject: [PATCH] [time] Exclude LogTime function in release builds (#24408) LogTime function that involves conversion of UTC time to string is built even if progress logging is disabled. Fix this. Signed-off-by: Damian Krolik Signed-off-by: Damian Krolik --- src/credentials/LastKnownGoodTime.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/credentials/LastKnownGoodTime.cpp b/src/credentials/LastKnownGoodTime.cpp index b8906a89bdb951..f9e2ed2ef27ea2 100644 --- a/src/credentials/LastKnownGoodTime.cpp +++ b/src/credentials/LastKnownGoodTime.cpp @@ -35,6 +35,7 @@ constexpr TLV::Tag kLastKnownGoodChipEpochSecondsTag = TLV::ContextTag(0); void LastKnownGoodTime::LogTime(const char * msg, System::Clock::Seconds32 chipEpochTime) { +#if CHIP_PROGRESS_LOGGING char buf[26] = { 0 }; // strlen("00000-000-000T000:000:000") == 25 uint16_t year; uint8_t month; @@ -45,6 +46,10 @@ void LastKnownGoodTime::LogTime(const char * msg, System::Clock::Seconds32 chipE ChipEpochToCalendarTime(chipEpochTime.count(), year, month, day, hour, minute, second); snprintf(buf, sizeof(buf), "%04u-%02u-%02uT%02u:%02u:%02u", year, month, day, hour, minute, second); ChipLogProgress(TimeService, "%s%s", StringOrNullMarker(msg), buf); +#else + IgnoreUnusedVariable(msg); + IgnoreUnusedVariable(chipEpochTime); +#endif } CHIP_ERROR LastKnownGoodTime::LoadLastKnownGoodChipEpochTime(System::Clock::Seconds32 & lastKnownGoodChipEpochTime) const