diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 7af0b759..7d2ffe67 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -762,17 +762,20 @@ inline std::chrono::duration get_milliseconds( return std::chrono::duration(static_cast(ms)); } -template +template ::value)> +OutputIt format_duration_value(OutputIt out, Rep val, int precision) { + static FMT_CONSTEXPR_DECL const Char format[] = {'{', '}', 0}; + return format_to(out, FMT_STRING(format), val); +} + +template ::value)> OutputIt format_duration_value(OutputIt out, Rep val, int precision) { static FMT_CONSTEXPR_DECL const Char pr_f[] = {'{', ':', '.', '{', '}', 'f', '}', 0}; if (precision >= 0) return format_to(out, FMT_STRING(pr_f), val, precision); static FMT_CONSTEXPR_DECL const Char fp_f[] = {'{', ':', 'g', '}', 0}; - static FMT_CONSTEXPR_DECL const Char format[] = {'{', '}', 0}; - if(std::is_floating_point::value) { - return format_to(out, FMT_STRING(fp_f), val); - } else { - return format_to(out, FMT_STRING(format), val); - } + return format_to(out, FMT_STRING(fp_f), val); } template