summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-02-07 17:10:32 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-02-07 17:10:32 +0000
commit19b70bd0538e2dae570096b24e8a3336b4f462b4 (patch)
tree5de63251009589e3648ba151da96eeee263935b5
parent3452db634a1fa72c895e285d2a92a68f0c983eeb (diff)
downloaddrakx-19b70bd0538e2dae570096b24e8a3336b4f462b4.tar
drakx-19b70bd0538e2dae570096b24e8a3336b4f462b4.tar.gz
drakx-19b70bd0538e2dae570096b24e8a3336b4f462b4.tar.bz2
drakx-19b70bd0538e2dae570096b24e8a3336b4f462b4.tar.xz
drakx-19b70bd0538e2dae570096b24e8a3336b4f462b4.zip
(formatXiB): more precise for cases like 1_234_000 -> 1.2GB
-rw-r--r--perl-install/common.pm7
1 files changed, 6 insertions, 1 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 52d798365..350591534 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -611,7 +611,12 @@ sub formatXiB {
$base >= 1024 ? ($newbase = $base / 1024) : ($newnb = $nb / 1024);
};
foreach ('', _("KB"), _("MB"), _("GB")) {
- $decr->(); $newnb >= 1 || $newnb * $newbase >= 1 or return int($nb * $base) . $_;
+ $decr->();
+ if ($newnb < 1 && $newnb * $newbase < 1) {
+ my $v = $nb * $base;
+ my $s = $v < 10 && int(10 * $v - 10 * int($v));
+ return int($v) . ($s ? ".$s" : '') . $_;
+ }
}
int($newnb * $newbase) . _("TB");
}