diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-02-07 17:10:32 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-02-07 17:10:32 +0000 |
commit | 19b70bd0538e2dae570096b24e8a3336b4f462b4 (patch) | |
tree | 5de63251009589e3648ba151da96eeee263935b5 /perl-install/common.pm | |
parent | 3452db634a1fa72c895e285d2a92a68f0c983eeb (diff) | |
download | drakx-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
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r-- | perl-install/common.pm | 7 |
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"); } |