[gnome-system-monitor] Fix calculated time delta for net stats Re-add a cast to 'double' to fix cases when the number of pa



commit 3e916c4ee21cede8465e9378fa07e9a71a472c2f
Author: Michael <michael debertol gmail com>
Date:   Fri Mar 27 15:12:26 2020 +0100

    Fix calculated time delta for net stats
    Re-add a cast to 'double' to fix cases when the number of passed seconds is
    not an int (ie. when the refresh rate is not set to a whole number of
    seconds)

 src/load-graph.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index d5b0ebe9..6417faec 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -646,7 +646,7 @@ get_net (LoadGraph *graph)
 
     if (in >= graph->net.last_in && out >= graph->net.last_out && graph->net.time != 0) {
         float dtime;
-        dtime = (time - graph->net.time) / G_USEC_PER_SEC;
+        dtime = ((double) (time - graph->net.time)) / G_USEC_PER_SEC;
         din   = static_cast<guint64>((in  - graph->net.last_in)  / dtime);
         dout  = static_cast<guint64>((out - graph->net.last_out) / dtime);
     } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]