mirror of
https://github.com/HowardHinnant/date.git
synced 2025-01-13 17:34:45 +08:00
Fix abs(duration) to work with non-normalized ratios
This commit is contained in:
parent
e6f4aed4d1
commit
2c035f8def
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user