Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
1267:1d8418cca63a | 1268:b7b84ae5f0a7 |
---|---|
46 if (sec == 0) { | 46 if (sec == 0) { |
47 while (nsec <= -ONE_BILLION) { nsec += ONE_BILLION; --sec; } | 47 while (nsec <= -ONE_BILLION) { nsec += ONE_BILLION; --sec; } |
48 while (nsec >= ONE_BILLION) { nsec -= ONE_BILLION; ++sec; } | 48 while (nsec >= ONE_BILLION) { nsec -= ONE_BILLION; ++sec; } |
49 } else if (sec < 0) { | 49 } else if (sec < 0) { |
50 while (nsec <= -ONE_BILLION) { nsec += ONE_BILLION; --sec; } | 50 while (nsec <= -ONE_BILLION) { nsec += ONE_BILLION; --sec; } |
51 while (nsec > 0) { nsec -= ONE_BILLION; ++sec; } | 51 while (nsec > 0 && sec < 0) { nsec -= ONE_BILLION; ++sec; } |
52 } else { | 52 } else { |
53 while (nsec >= ONE_BILLION) { nsec -= ONE_BILLION; ++sec; } | 53 while (nsec >= ONE_BILLION) { nsec -= ONE_BILLION; ++sec; } |
54 while (nsec < 0) { nsec += ONE_BILLION; --sec; } | 54 while (nsec < 0 && sec > 0) { nsec += ONE_BILLION; --sec; } |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 RealTime | 58 RealTime |
59 RealTime::fromSeconds(double sec) | 59 RealTime::fromSeconds(double sec) |