]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/rados/rados.cc: fix UNINTENDED_INTEGER_DIVISION
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 17 Sep 2015 12:54:58 +0000 (14:54 +0200)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Fri, 29 Jan 2016 20:51:17 +0000 (21:51 +0100)
Fix for:

CID 1297882 (#1 of 1): Result is not floating-point (UNINTENDED_INTEGER_DIVISION)
 integer_division: Dividing integer expressions ns and 1000000000UL, and then
 converting the integer quotient to type float. Any remainder, or fractional
 part of the quotient, is ignored.

Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
src/tools/rados/rados.cc

index 36f620bc209de665472ed2e9d99a7b8a1c4eb739..85aeb0187abe32b2df43cb7164f5453471eac38a 100644 (file)
@@ -569,7 +569,7 @@ public:
     utime_t now = ceph_clock_now(g_ceph_context);
     now -= start_time;
     uint64_t ns = now.nsec();
-    float total = ns / 1000000000;
+    float total = (float) ns / 1000000000.0;
     total += now.sec();
     return total;
   }