Skip to content

Commit

Permalink
Fix scope for glibc ext for sec, min, and hour (#3812)
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
  • Loading branch information
phprus committed Jan 16, 2024
1 parent 13ec66b commit 470c4e6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end,
if (begin == end || *begin == '}') return begin;
if (*begin != '%') FMT_THROW(format_error("invalid format"));
auto ptr = begin;
pad_type pad = pad_type::unspecified;
while (ptr != end) {
pad_type pad = pad_type::unspecified;
auto c = *ptr;
if (c == '}') break;
if (c != '%') {
Expand Down
1 change: 1 addition & 0 deletions test/chrono-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@ TEST(chrono_test, glibc_extensions) {
EXPECT_EQ(fmt::format("{:%0I,%0H,%0M,%0S}", d), "01,01,02,03");
EXPECT_EQ(fmt::format("{:%_I,%_H,%_M,%_S}", d), " 1, 1, 2, 3");
EXPECT_EQ(fmt::format("{:%-I,%-H,%-M,%-S}", d), "1,1,2,3");
EXPECT_EQ(fmt::format("{:%-I,%H,%M,%S}", d), "1,01,02,03");

EXPECT_EQ(fmt::format("{:%OI,%OH,%OM,%OS}", d), "01,01,02,03");
EXPECT_EQ(fmt::format("{:%0OI,%0OH,%0OM,%0OS}", d), "01,01,02,03");
Expand Down

0 comments on commit 470c4e6

Please sign in to comment.