Skip to content

Commit

Permalink
%T is %H:%M:%S (#3349)
Browse files Browse the repository at this point in the history
  • Loading branch information
brevzin committed Mar 18, 2023
1 parent d8e1c42 commit 93bfa05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 3 additions & 4 deletions include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -1624,10 +1624,9 @@ class tm_writer {
write2(tm_min());
}
void on_iso_time() {
char buf[8];
write_digit2_separated(buf, to_unsigned(tm_hour()), to_unsigned(tm_min()),
to_unsigned(tm_sec()), ':');
out_ = copy_str<Char>(std::begin(buf), std::end(buf), out_);
on_24_hour_time();
*out_++ = ':';
on_second(numeric_system::standard, pad_type::unspecified);
}

void on_am_pm() {
Expand Down
2 changes: 2 additions & 0 deletions test/chrono-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,8 @@ TEST(chrono_test, timestamps_sub_seconds) {

EXPECT_EQ(fmt::format("{}.{}", strftime_full_utc(t9_sec), t9_sub_sec_part),
fmt::format("{:%Y-%m-%d %H:%M:%S}", t9));
EXPECT_EQ(fmt::format("{}.{}", strftime_full_utc(t9_sec), t9_sub_sec_part),
fmt::format("{:%Y-%m-%d %T}", t9));

const std::chrono::time_point<std::chrono::system_clock,
std::chrono::milliseconds>
Expand Down

0 comments on commit 93bfa05

Please sign in to comment.