Kiosk: show all user-visible times as 12-hour AM/PM

Add datetime::formatHm12h/formatTime12h and use them for the Home footer
clock, the Timezone page's local-time sample, and the log viewer
timestamps. Storage and parsing remain 24-hour HH:MM. Extends the
date-format tests with the midnight/noon edge cases.
This commit is contained in:
NeilClack
2026-09-29 08:43:59 -05:00
parent 336f47c6ac
commit 59b499037b
6 changed files with 113 additions and 3 deletions
+8 -1
View File
@@ -1,5 +1,6 @@
#include "timezone_page.h"
#include "app_state.h"
#include "date_format.h"
#include "logical_size.h"
#include <SDL3/SDL.h>
#include <algorithm>
@@ -237,7 +238,13 @@ void TimeZonePage::render(SDL_Renderer* renderer) {
}
time_t now = std::time(nullptr);
std::string localSample = "Local Time: " + radiantwave::timezone::formatUtcToTimezone(now, currentTzCode_);
// Show the configured zone's wall-clock time with an AM/PM label; storage
// and the rest of the app stay 24-hour.
std::string localSample = "Local Time: " +
radiantwave::timezone::formatUtcToTimezone(now, currentTzCode_, "%Y-%m-%d") + " " +
radiantwave::datetime::formatHm12h(
radiantwave::timezone::formatUtcToTimezone(now, currentTzCode_, "%H:%M")) +
" " + radiantwave::timezone::formatUtcToTimezone(now, currentTzCode_, "%Z");
sampleText_.ensure(renderer, fontHeader_, localSample, green);
if (sampleText_.texture) {
SDL_FRect dst{700.0f, currentY, sampleText_.width, sampleText_.height};