Skip to content

Commit

Permalink
[ESP32] Fix incorrect RTC log format in SystemTimeSupport (project-ch…
Browse files Browse the repository at this point in the history
…ip#37535)

* esp32: Fix incorrect RTC log format in SystemTimeSupport

* esp32: used strftime for formatting
  • Loading branch information
pimpalemahesh authored Feb 12, 2025
1 parent b99f977 commit 4657e36
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/platform/ESP32/SystemTimeSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ CHIP_ERROR ClockImpl::SetClock_RealTime(Microseconds64 aNewCurTime)
const time_t timep = tv.tv_sec;
struct tm calendar;
localtime_r(&timep, &calendar);
ChipLogProgress(DeviceLayer, "Real time clock set to %lld (%04d/%02d/%02d %02d:%02d:%02d UTC)",
static_cast<long long>(tv.tv_sec), calendar.tm_year, calendar.tm_mon, calendar.tm_mday, calendar.tm_hour,
calendar.tm_min, calendar.tm_sec);
char time_str[64];
strftime(time_str, sizeof(time_str), "%Y-%m-%d %H:%M:%S UTC", &calendar);
ChipLogProgress(DeviceLayer, "Real time clock set to %lld (%s)", static_cast<long long>(tv.tv_sec), time_str);
}
#endif // CHIP_PROGRESS_LOGGING
return CHIP_NO_ERROR;
Expand Down

0 comments on commit 4657e36

Please sign in to comment.