mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-28 05:09:44 +01:00
Fix time_point formatting for durations with certain ratios (#3430)
* Fix time_point formatting * Add timestamps_ratios tests
This commit is contained in:
committed by
GitHub
parent
ebfb2e6779
commit
d7592ad8bf
@@ -2142,7 +2142,8 @@ struct formatter<std::chrono::time_point<std::chrono::system_clock, Duration>,
|
||||
epoch - std::chrono::duration_cast<std::chrono::seconds>(epoch));
|
||||
|
||||
if (subsecs.count() < 0) {
|
||||
auto second = std::chrono::seconds(1);
|
||||
auto second = std::chrono::duration_cast<Duration>(
|
||||
std::chrono::seconds(1));
|
||||
if (epoch.count() < ((Duration::min)() + second).count())
|
||||
FMT_THROW(format_error("duration is too small"));
|
||||
subsecs += second;
|
||||
|
||||
Reference in New Issue
Block a user