diff options
author | zachir <zachir@librem.one> | 2023-03-17 18:09:25 -0500 |
---|---|---|
committer | zachir <zachir@librem.one> | 2023-03-17 18:09:25 -0500 |
commit | ab328b257f981e5cab2dcd4e0e77b30928736e55 (patch) | |
tree | 7ce855b9914bfe2da26ac121241b2df1f92bff47 /net-speed-widget | |
parent | d1c047c78a647d0703785303c1ded6fb24ae0127 (diff) |
Revert "make net widget use bytes, not bits"
This reverts commit d1c047c78a647d0703785303c1ded6fb24ae0127.
Diffstat (limited to 'net-speed-widget')
-rw-r--r-- | net-speed-widget/net-speed.lua | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/net-speed-widget/net-speed.lua b/net-speed-widget/net-speed.lua index c0d709e..daa218a 100644 --- a/net-speed-widget/net-speed.lua +++ b/net-speed-widget/net-speed.lua @@ -20,21 +20,21 @@ local net_speed_widget = {} local function convert_to_h(bytes) local speed local dim - local l_bytes = bytes - if l_bytes < 1000 then - speed = l_bytes + local bits = bytes * 8 + if bits < 1000 then + speed = bits dim = 'b' - elseif l_bytes < 1000000 then - speed = l_bytes/1000 + elseif bits < 1000000 then + speed = bits/1000 dim = 'k' - elseif l_bytes < 1000000000 then - speed = l_bytes/1000000 + elseif bits < 1000000000 then + speed = bits/1000000 dim = 'm' - elseif l_bytes < 1000000000000 then - speed = l_bytes/1000000000 + elseif bits < 1000000000000 then + speed = bits/1000000000 dim = 'g' else - speed = tonumber(l_bytes) + speed = tonumber(bits) dim = 'b' end return math.floor(speed + 0.5) .. dim |