Fix precision 0 with std::chrono::duration and added additional tests. (#2588)

This commit is contained in:
lukester1975
2021-11-06 15:57:22 +00:00
committed by GitHub
parent e67f92c55c
commit 12b1d8b14a
2 changed files with 23 additions and 2 deletions

View File

@@ -923,8 +923,8 @@ template <typename Char, typename Rep, typename OutputIt,
OutputIt format_duration_value(OutputIt out, Rep val, int precision) {
auto specs = basic_format_specs<Char>();
specs.precision = precision;
specs.type = precision > 0 ? presentation_type::fixed_lower
: presentation_type::general_lower;
specs.type = precision >= 0 ? presentation_type::fixed_lower
: presentation_type::general_lower;
return write<Char>(out, val, specs);
}