Skip to content

Commit 4657e36

Browse files
[ESP32] Fix incorrect RTC log format in SystemTimeSupport (#37535)
* esp32: Fix incorrect RTC log format in SystemTimeSupport * esp32: used strftime for formatting
1 parent b99f977 commit 4657e36

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/platform/ESP32/SystemTimeSupport.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ CHIP_ERROR ClockImpl::SetClock_RealTime(Microseconds64 aNewCurTime)
9494
const time_t timep = tv.tv_sec;
9595
struct tm calendar;
9696
localtime_r(&timep, &calendar);
97-
ChipLogProgress(DeviceLayer, "Real time clock set to %lld (%04d/%02d/%02d %02d:%02d:%02d UTC)",
98-
static_cast<long long>(tv.tv_sec), calendar.tm_year, calendar.tm_mon, calendar.tm_mday, calendar.tm_hour,
99-
calendar.tm_min, calendar.tm_sec);
97+
char time_str[64];
98+
strftime(time_str, sizeof(time_str), "%Y-%m-%d %H:%M:%S UTC", &calendar);
99+
ChipLogProgress(DeviceLayer, "Real time clock set to %lld (%s)", static_cast<long long>(tv.tv_sec), time_str);
100100
}
101101
#endif // CHIP_PROGRESS_LOGGING
102102
return CHIP_NO_ERROR;

0 commit comments

Comments
 (0)