mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 07:29:32 +00:00
scripts/lua/modules/lua_utils.lua: fix precision of bytes
This commit lets the bytesToSize() function perform the requested rounding even when returning bytes. This also fixes the symbol used in that case as a measure unit so that it is consistent.
This commit is contained in:
parent
3afe49b8e6
commit
317c9b5d54
1 changed files with 2 additions and 2 deletions
|
|
@ -354,7 +354,7 @@ function bytesToSize(bytes)
|
|||
terabyte = gigabyte * 1024;
|
||||
|
||||
if((bytes >= 0) and (bytes < kilobyte)) then
|
||||
return bytes .. " Bytes";
|
||||
return round(bytes, precision) .. " B";
|
||||
elseif((bytes >= kilobyte) and (bytes < megabyte)) then
|
||||
return round(bytes / kilobyte, precision) .. ' KB';
|
||||
elseif((bytes >= megabyte) and (bytes < gigabyte)) then
|
||||
|
|
@ -364,7 +364,7 @@ function bytesToSize(bytes)
|
|||
elseif(bytes >= terabyte) then
|
||||
return round(bytes / terabyte, precision) .. ' TB';
|
||||
else
|
||||
return bytes .. ' B';
|
||||
return round(bytes, precision) .. ' B';
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue