adding a default format for std::chrono::time_point<std::chrono::syst… (#2345)

This commit is contained in:
sunmy2019
2021-06-12 01:52:39 +08:00
committed by GitHub
parent 55010a9d3a
commit f28cf3302d
3 changed files with 26 additions and 0 deletions

View File

@@ -99,6 +99,7 @@ template <typename TimePoint> auto strftime(TimePoint tp) -> std::string {
TEST(chrono_test, time_point) {
auto t1 = std::chrono::system_clock::now();
EXPECT_EQ(strftime(t1), fmt::format("{:%Y-%m-%d %H:%M:%S}", t1));
EXPECT_EQ(strftime(t1), fmt::format("{}", t1));
using time_point =
std::chrono::time_point<std::chrono::system_clock, std::chrono::seconds>;
auto t2 = time_point(std::chrono::seconds(42));