diff --git a/include/fmt/chrono.h b/include/fmt/chrono.h index c43ad011f677..e1c514689f3d 100644 --- a/include/fmt/chrono.h +++ b/include/fmt/chrono.h @@ -524,13 +524,9 @@ struct chrono_formatter { // this may overflow and/or the result may not fit in the // target type. #if FMT_SAFE_DURATION_CAST - int ec; // might need checked conversion (rep!=Rep) auto tmpval = std::chrono::duration(val); - s = safe_duration_cast::safe_duration_cast(tmpval, ec); - if (ec) { - FMT_THROW(format_error("value would cause UB or the wrong result")); - } + s = fmt_safe_duration_cast(tmpval); #else s = std::chrono::duration_cast( std::chrono::duration(val));