From ff64562ae06d8a625f7ccb71e0c196b2a025484c Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Thu, 3 Feb 2011 03:20:40 -0800 Subject: [PATCH] include/utime.h: avoid comparing float with 0 Avoid doing an exact comparison of a float with 0. Signed-off-by: Colin McCabe --- src/include/utime.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/include/utime.h b/src/include/utime.h index cdd35bfca8e00..1333837cfb408 100644 --- a/src/include/utime.h +++ b/src/include/utime.h @@ -148,9 +148,10 @@ inline utime_t& operator-=(utime_t& l, double f) { double fs = trunc(f); double ns = (f - fs) * (double)1000000000.0; l.sec_ref() -= (long)fs; - if (ns) { + long nsl = (long)ns; + if (nsl) { l.sec_ref()--; - l.nsec_ref() = 1000000000L + l.nsec_ref() - (long)ns; + l.nsec_ref() = 1000000000L + l.nsec_ref() - nsl; } l.normalize(); return l; -- 2.39.5