changeset 476:15348e89c1d7

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 e2716b9352ca
children 628a5b8ff634
files src/vamp-sdk/RealTime.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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; }
     }
 }