mirror of https://github.com/schoebel/mars
marsadm: better human-readable units
This commit is contained in:
parent
b1dcc86784
commit
366711cee3
|
@ -3536,10 +3536,11 @@ sub number2human {
|
|||
my ($number, $unit, $max) = @_;
|
||||
$max = $number if !defined($max);
|
||||
my $k = 1024.0;
|
||||
my $flip_over = 9.99;
|
||||
if (!defined($unit) || !$unit) {
|
||||
if ($max >= $k * $k * $k * $k) {
|
||||
if ($max >= $k * $k * $k * $k * $flip_over) {
|
||||
$unit = "T";
|
||||
} elsif ($max >= $k * $k * $k) {
|
||||
} elsif ($max >= $k * $k * $k * $flip_over) {
|
||||
$unit = "G";
|
||||
} elsif ($max >= $k * $k) {
|
||||
$unit = "M";
|
||||
|
|
Loading…
Reference in New Issue