Patch to fix rounding error with CPU values.
[monky] / src / common.c
index bd3005d..17d246f 100644 (file)
@@ -463,7 +463,8 @@ void update_stuff(void)
 #endif
 }
 
-int round_to_int(float f)
+/* Ohkie to return negative values for temperatures */
+int round_to_int_temp(float f)
 {
        if (f >= 0.0) {
                return (int) (f + 0.5);
@@ -471,3 +472,13 @@ int round_to_int(float f)
                return (int) (f - 0.5);
        }
 }
+/* Don't return negative values for cpugraph, bar, gauge, percentage.
+ * Causes unreasonable numbers to show */
+unsigned int round_to_int(float f)
+{
+       if (f >= 0.0) {
+               return (int) (f + 0.5);
+       } else {
+               return 0;
+       }
+}