From b2ef7ee53172599e874c24e1efbf61e0ac0f4a40 Mon Sep 17 00:00:00 2001 From: cflip Date: Tue, 12 Apr 2022 18:00:10 -0600 Subject: [PATCH] LibC+LibCore: Change a.m./p.m. to AM/PM --- Userland/Libraries/LibC/time.cpp | 4 ++-- Userland/Libraries/LibCore/DateTime.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Userland/Libraries/LibC/time.cpp b/Userland/Libraries/LibC/time.cpp index a2a7b4eee8..ca26880527 100644 --- a/Userland/Libraries/LibC/time.cpp +++ b/Userland/Libraries/LibC/time.cpp @@ -270,13 +270,13 @@ size_t strftime(char* destination, size_t max_size, char const* format, const st builder.append('\n'); break; case 'p': - builder.append(tm->tm_hour < 12 ? "a.m." : "p.m."); + builder.append(tm->tm_hour < 12 ? "AM" : "PM"); break; case 'r': { int display_hour = tm->tm_hour % 12; if (display_hour == 0) display_hour = 12; - builder.appendff("{:02}:{:02}:{:02} {}", display_hour, tm->tm_min, tm->tm_sec, tm->tm_hour < 12 ? "a.m." : "p.m."); + builder.appendff("{:02}:{:02}:{:02} {}", display_hour, tm->tm_min, tm->tm_sec, tm->tm_hour < 12 ? "AM" : "PM"); break; } case 'R': diff --git a/Userland/Libraries/LibCore/DateTime.cpp b/Userland/Libraries/LibCore/DateTime.cpp index 479c433dfa..0f3530f375 100644 --- a/Userland/Libraries/LibCore/DateTime.cpp +++ b/Userland/Libraries/LibCore/DateTime.cpp @@ -173,13 +173,13 @@ String DateTime::to_string(StringView format) const builder.append('\n'); break; case 'p': - builder.append(tm.tm_hour < 12 ? "a.m." : "p.m."); + builder.append(tm.tm_hour < 12 ? "AM" : "PM"); break; case 'r': { int display_hour = tm.tm_hour % 12; if (display_hour == 0) display_hour = 12; - builder.appendff("{:02}:{:02}:{:02} {}", display_hour, tm.tm_min, tm.tm_sec, tm.tm_hour < 12 ? "a.m." : "p.m."); + builder.appendff("{:02}:{:02}:{:02} {}", display_hour, tm.tm_min, tm.tm_sec, tm.tm_hour < 12 ? "AM" : "PM"); break; } case 'R': @@ -427,19 +427,19 @@ Optional DateTime::parse(StringView format, String const& string) } break; case 'p': { - auto ampm = string.substring_view(string_pos, 4); - if (ampm == "p.m." && tm.tm_hour < 12) { + auto ampm = string.substring_view(string_pos, 2); + if (ampm == "PM" && tm.tm_hour < 12) { tm.tm_hour += 12; } - string_pos += 4; + string_pos += 2; break; } case 'r': { - auto ampm = string.substring_view(string_pos, 4); - if (ampm == "p.m." && tm.tm_hour < 12) { + auto ampm = string.substring_view(string_pos, 2); + if (ampm == "PM" && tm.tm_hour < 12) { tm.tm_hour += 12; } - string_pos += 4; + string_pos += 2; break; } case 'R': {