Performance improvement

This commit is contained in:
Vladislav Shchapov 2021-10-28 21:15:41 +05:00
parent 18440ef81b
commit 91c454b7ff

View File

@ -1459,8 +1459,9 @@ template <typename OutputIt, typename Char> class tm_writer {
} }
auto tm_hour12() const noexcept -> int { auto tm_hour12() const noexcept -> int {
auto hour = tm_hour() % 12; const auto h = tm_hour();
return hour == 0 ? 12 : hour; const auto z = h < 12 ? h : h - 12;
return z == 0 ? 12 : z;
} }
// POSIX and the C Standard are unclear or inconsistent about what %C and %y // POSIX and the C Standard are unclear or inconsistent about what %C and %y