Skip to content

Commit

Permalink
reuse earlier extract fmt_safe_... function
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldreik committed Jun 17, 2019
1 parent b23388d commit 63084ca
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions include/fmt/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -666,14 +666,10 @@ struct chrono_formatter {
if (ns == numeric_system::standard) {
write(second(), 2);
#if FMT_SAFE_DURATION_CAST
int ec;
// convert rep->Rep
using Crep = std::chrono::duration<rep, Period>;
using CRep = std::chrono::duration<Rep, Period>;
auto tmpval = safe_duration_cast::safe_duration_cast<CRep>(Crep{val}, ec);
if (ec) {
FMT_THROW(format_error("value would cause UB or the wrong result"));
}
auto tmpval = fmt_safe_duration_cast<CRep>(Crep{val});
#else
auto tmpval = std::chrono::duration<Rep, Period>(val);
#endif
Expand Down

0 comments on commit 63084ca

Please sign in to comment.