fix SI prefixes

- lower 'm' is milli, not mega
- lower 'g' is unassigned
- 'G' is 10^9, 'Gi' is 2^30

see https://en.wikipedia.org/wiki/Metric_prefix
This commit is contained in:
Nuno Silva 2023-11-18 17:08:39 +00:00
parent a878abaa68
commit 2717d15af5
2 changed files with 4 additions and 4 deletions

View File

@ -159,7 +159,7 @@ local function worker(user_args)
{ {
text = math.floor(disks[v].used / 1024 / 1024) text = math.floor(disks[v].used / 1024 / 1024)
.. '/' .. '/'
.. math.floor(disks[v].size / 1024 / 1024) .. 'GB(' .. math.floor(disks[v].size / 1024 / 1024) .. 'GiB('
.. math.floor(disks[v].perc) .. '%)', .. math.floor(disks[v].perc) .. '%)',
widget = wibox.widget.textbox widget = wibox.widget.textbox
}, },

View File

@ -29,15 +29,15 @@ local function convert_to_h(bytes)
dim = 'kb/s' dim = 'kb/s'
elseif bits < 1000000000 then elseif bits < 1000000000 then
speed = bits/1000000 speed = bits/1000000
dim = 'mb/s' dim = 'Mb/s'
elseif bits < 1000000000000 then elseif bits < 1000000000000 then
speed = bits/1000000000 speed = bits/1000000000
dim = 'gb/s' dim = 'Gb/s'
else else
speed = tonumber(bits) speed = tonumber(bits)
dim = 'b/s' dim = 'b/s'
end end
return math.floor(speed + 0.5) .. dim return math.floor(speed + 0.5) .. ' ' .. dim
end end
local function split(string_to_split, separator) local function split(string_to_split, separator)