mirror of
https://github.com/HowardHinnant/date.git
synced 2025-08-04 21:24:26 +02:00
Fix abs(duration) to work with non-normalized ratios
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user