mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-29 18:27:40 +02:00
Report an error on overflow
This commit is contained in:
@ -2109,8 +2109,11 @@ struct formatter<std::chrono::time_point<std::chrono::system_clock, Duration>,
|
||||
epoch - std::chrono::duration_cast<std::chrono::seconds>(epoch));
|
||||
|
||||
if (subsecs.count() < 0) {
|
||||
subsecs += std::chrono::seconds(1);
|
||||
val -= std::chrono::seconds(1);
|
||||
auto second = std::chrono::seconds(1);
|
||||
if (epoch.count() < (Duration::min() + second).count())
|
||||
FMT_THROW(format_error("duration is too small"));
|
||||
subsecs += second;
|
||||
val -= second;
|
||||
}
|
||||
|
||||
return formatter<std::tm, Char>::do_format(
|
||||
|
Reference in New Issue
Block a user