]> xenbits.xensource.com Git - libvirt.git/commitdiff
Switch float -> double when calculating CPU time in dominfo command to avoid loss...
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 13 Jun 2006 19:08:40 +0000 (19:08 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 13 Jun 2006 19:08:40 +0000 (19:08 +0000)
ChangeLog
src/virsh.c

index b3a3217c03f3908593ba21fdee421c853b1581d3..5aa9fc27c9d2e7f08ce2f22a9087efc94def4f1e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Tue Jun 13 14:06:01 EDT 2006 Daniel P. Berrange <berrange@redhat.com>
+
+       * src/virsh.c: use 'double' instead of 'float' when calculating
+       'CPU time' field for dominfo command, to ensure no unneccessary
+       loss of precision converting from nanoseconds to seconds.
+
 Tue Jun 13 18:35:22 EDT 2006 Daniel Veillard <veillard@redhat.com>
 
        * src/libvirt.c src/xen_internal.c src/xend_internal.c
index ff8aff04ac4153f47c4c53cc69e3d1149f5a9756..3b5e242c7b2e14ff5e0cdf6a01f54332d6dded49 100644 (file)
@@ -773,11 +773,11 @@ cmdDominfo(vshControl * ctl, vshCmd * cmd)
         vshPrint(ctl, "%-15s %d\n", "CPU(s):", info.nrVirtCpu);
 
         if (info.cpuTime != 0) {
-            float cpuUsed = info.cpuTime;
+           double cpuUsed = info.cpuTime;
 
-            cpuUsed /= 1000000000;
+            cpuUsed /= 1000000000.0;
 
-            vshPrint(ctl, "%-15s %.1fs\n", "CPU time:", cpuUsed);
+            vshPrint(ctl, "%-15s %.1lfs\n", "CPU time:", cpuUsed);
         }
 
         vshPrint(ctl, "%-15s %lu kB\n", "Max memory:",