Fix abs(duration) to work with non-normalized ratios

This commit is contained in:
Howard Hinnant 2022-08-12 10:28:12 -04:00
parent e6f4aed4d1
commit 2c035f8def

View File

@ -1316,7 +1316,7 @@ CONSTCD11
std::chrono::duration<Rep, Period> std::chrono::duration<Rep, Period>
abs(std::chrono::duration<Rep, Period> d) abs(std::chrono::duration<Rep, Period> d)
{ {
return d >= d.zero() ? d : -d; return d >= d.zero() ? d : static_cast<decltype(d)>(-d);
} }
// round down // round down