Skip to content

Commit

Permalink
Performance improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
phprus committed Oct 28, 2021
1 parent 83e0c1a commit 6e4b06d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,9 @@ template <typename OutputIt, typename Char> class tm_writer {
}

auto tm_hour12() const noexcept -> int {
auto hour = tm_hour() % 12;
return hour == 0 ? 12 : hour;
const auto h = tm_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
Expand Down

0 comments on commit 6e4b06d

Please sign in to comment.