diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 7bd4206d..89be0739 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -2088,7 +2088,7 @@ struct formatter, if (subsecs.count() < 0) { auto second = std::chrono::duration_cast(std::chrono::seconds(1)); - if (epoch.count() < ((Duration::min)() + second).count()) + if ((epoch + second).count() < ((Duration::min)() + second).count()) FMT_THROW(format_error("duration is too small")); subsecs += second; val -= second; diff --git a/test/chrono-test.cc b/test/chrono-test.cc index 07760688..dadd0af3 100644 --- a/test/chrono-test.cc +++ b/test/chrono-test.cc @@ -1002,4 +1002,4 @@ TEST(chrono_test, glibc_extensions) { EXPECT_EQ(fmt::format("{:%_S}", d), " 3.140000"); EXPECT_EQ(fmt::format("{:%-S}", d), "3.140000"); } -} +} \ No newline at end of file