diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index 0769284c..80b8b483 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -764,14 +764,12 @@ OutputIt format_duration_value(OutputIt out, Rep val, int precision) { template OutputIt format_duration_unit(OutputIt out) { - if (const char* unit = get_units()) { - string_view s(unit); - if (std::is_same::value) { - utf8_to_utf16 u(s); + if (string_view unit = get_units()) { + if (const_check(std::is_same())) { + utf8_to_utf16 u(unit); return std::copy(u.c_str(), u.c_str() + u.size(), out); - } else { - return std::copy(s.begin(), s.end(), out); } + return std::copy(unit.begin(), unit.end(), out); } const Char num_f[] { '[', '{', '}', ']', 's', 0 }; if (Period::den == 1) return format_to(out, num_f, Period::num);