Mercurial > hg > svcore
diff base/RealTimeSV.cpp @ 1268:b7b84ae5f0a7 3.0-integration
Fix fairly obscure mis-canonicalisation in RealTime (leading to non-canonical but still correct values)
author | Chris Cannam |
---|---|
date | Fri, 18 Nov 2016 12:53:21 +0000 |
parents | c4f873749ab5 |
children | a1af054d8f75 |
line wrap: on
line diff
--- a/base/RealTimeSV.cpp Thu Nov 17 14:46:03 2016 +0000 +++ b/base/RealTimeSV.cpp Fri Nov 18 12:53:21 2016 +0000 @@ -48,10 +48,10 @@ while (nsec >= ONE_BILLION) { nsec -= ONE_BILLION; ++sec; } } else if (sec < 0) { while (nsec <= -ONE_BILLION) { nsec += ONE_BILLION; --sec; } - while (nsec > 0) { nsec -= ONE_BILLION; ++sec; } + while (nsec > 0 && sec < 0) { nsec -= ONE_BILLION; ++sec; } } else { while (nsec >= ONE_BILLION) { nsec -= ONE_BILLION; ++sec; } - while (nsec < 0) { nsec += ONE_BILLION; --sec; } + while (nsec < 0 && sec > 0) { nsec += ONE_BILLION; --sec; } } }