# HG changeset patch # User Chris Cannam # Date 1479473601 0 # Node ID 15348e89c1d72adfda2fb495638f135370b36589 # Parent e2716b9352ca923c5427463321db284dac0b4348 Fix fairly obscure mis-canonicalisation in RealTime (leading to non-canonical but still correct values) diff -r e2716b9352ca -r 15348e89c1d7 src/vamp-sdk/RealTime.cpp --- a/src/vamp-sdk/RealTime.cpp Tue Nov 15 16:53:46 2016 +0000 +++ b/src/vamp-sdk/RealTime.cpp Fri Nov 18 12:53:21 2016 +0000 @@ -82,10 +82,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; } } }