diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 15cfa412..cae242a4 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -1595,20 +1595,21 @@ struct chrono_formatter { static constexpr auto fractional_width = detail::num_digits(Duration::period::num, Duration::period::den); - using precision = std::chrono::duration< + using subsecond_precision = std::chrono::duration< typename std::common_type::type, std::ratio<1, detail::pow10(fractional_width)>>; // We could use c++ 17 if constexpr here. - if (std::ratio_less::value) { *out++ = '.'; const auto subseconds = - std::chrono::treat_as_floating_point::value + std::chrono::treat_as_floating_point< + typename subsecond_precision::rep>::value ? (detail::abs(d) - std::chrono::duration_cast(d)) .count() - : std::chrono::duration_cast( + : std::chrono::duration_cast( detail::abs(d) - std::chrono::duration_cast(d)) .count();