handling fails when use minimum time_point
This commit is contained in:
parent
6b0082e6c7
commit
382a7b99d4
@ -2088,7 +2088,7 @@ struct formatter<std::chrono::time_point<std::chrono::system_clock, Duration>,
|
||||
if (subsecs.count() < 0) {
|
||||
auto second =
|
||||
std::chrono::duration_cast<Duration>(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;
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user