summaryrefslogtreecommitdiff
path: root/net-speed-widget
diff options
context:
space:
mode:
authorNuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>2021-06-06 02:24:32 +0100
committerNuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>2021-06-06 02:24:32 +0100
commitc4606372b3ddc4ac2bf16b67eadfc61598cd27aa (patch)
tree00f06f53af7a17481384350a6f2810769de40c21 /net-speed-widget
parent7ecaccf85fd1ec7f3dc4754c124f80acfe7eec2c (diff)
net-speed-widget: fix speed calculation
need to divide by time
Diffstat (limited to 'net-speed-widget')
-rw-r--r--net-speed-widget/net-speed.lua4
1 files changed, 2 insertions, 2 deletions
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))