From c4606372b3ddc4ac2bf16b67eadfc61598cd27aa Mon Sep 17 00:00:00 2001 From: Nuno Silva Date: Sun, 6 Jun 2021 02:24:32 +0100 Subject: net-speed-widget: fix speed calculation need to divide by time --- net-speed-widget/net-speed.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net-speed-widget') diff --git a/net-speed-widget/net-speed.lua b/net-speed-widget/net-speed.lua index 2fb1aa1..8ba708d 100644 --- a/net-speed-widget/net-speed.lua +++ b/net-speed-widget/net-speed.lua @@ -104,8 +104,8 @@ local function worker(user_args) if i%2 == 0 then cur_tx = cur_tx + cur_vals[i] end end - local speed_rx = cur_rx - prev_rx - local speed_tx = cur_tx - prev_tx + local speed_rx = (cur_rx - prev_rx) / timeout + local speed_tx = (cur_tx - prev_tx) / timeout widget:set_rx_text(convert_to_h(speed_rx)) widget:set_tx_text(convert_to_h(speed_tx)) -- cgit v1.2.3