diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 6915c5ca..6453d526 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -1589,7 +1589,8 @@ struct chrono_formatter { } } - void write(Rep value, int width) { + template + void write(RepType value, int width) { write_sign(); if (isnan(value)) return write_nan(); uint32_or_64_or_128_t n = @@ -1676,20 +1677,13 @@ struct chrono_formatter { if (ns == numeric_system::standard) { write(second(), 2); -#if FMT_SAFE_DURATION_CAST - // convert rep->Rep using duration_rep = std::chrono::duration; - using duration_Rep = std::chrono::duration; - auto tmpval = fmt_safe_duration_cast(duration_rep{val}); -#else - auto tmpval = std::chrono::duration(val); -#endif - using subsec_helper = detail::subsecond_helper; + using subsec_helper = detail::subsecond_helper; // Could use c++ 17 if constexpr if (std::ratio_less::value) { *out++ = '.'; - write(subsec_helper::get_subseconds(tmpval), subsec_helper::fractional_width); + write(subsec_helper::get_subseconds(duration_rep{val}), subsec_helper::fractional_width); } return; }