Skip to content

refactor(settings): format RTC local time with strftime - #251

Merged
dianjixz merged 1 commit into
masterfrom
refactor/rtc-local-time-strftime
Nov 13, 2026
Merged

dianjixz merged 1 commit into
masterfrom
refactor/rtc-local-time-strftime

Conversation

@dianjixz

Copy link
Copy Markdown
Collaborator

Replace the hand-rolled std::snprintf format string in settings_rtc_local_time_text() with std::strftime using the equivalent "%Y-%m-%d %H:%M:%S" format, dropping the per-field tm_year/tm_mon conversions. Output is unchanged, and with an int tm_year the longest possible string is 25 characters, so the 32-byte buffer cannot truncate.

Replace the hand-rolled std::snprintf format string in
settings_rtc_local_time_text() with std::strftime using the equivalent
"%Y-%m-%d %H:%M:%S" format, dropping the per-field tm_year/tm_mon
conversions. Output is unchanged, and with an int tm_year the longest
possible string is 25 characters, so the 32-byte buffer cannot truncate.
@dianjixz
dianjixz merged commit 12c98f5 into master Nov 13, 2026
7 checks passed
@dianjixz
dianjixz deleted the refactor/rtc-local-time-strftime branch November 13, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant