Merge pull request #1700 from SimonFair/Show-decimal-on-disk-1TB

Show decimals for vdisk > 1TB
This commit is contained in:
tom mortensen
2024-04-12 14:01:23 -07:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -49,7 +49,7 @@ function showCPUs($uuid) {
function vsize($size,$expand=true) {
$units = ['','K','M','G','T','P','E','Z','Y'];
if ($expand) {
$size = str_replace(['B',' ',',', '.'],'',strtoupper($size));
$size = str_replace(['B',' ',','],'',strtoupper($size));
[$c1,$c2] = my_preg_split('/(?<=[0-9])(?=[A-Z])/',$size);
return $c1 * pow(1024,array_search($c2,$units)?:0);
} else {

View File

@@ -1473,7 +1473,7 @@
$unit = strtoupper($unit);
switch ($unit) {
case 'T': return number_format($value / (float)1099511627776, $decimals).'T';
case 'T': return number_format($value / (float)1099511627776, $decimals +2).'T';
case 'G': return number_format($value / (float)(1 << 30), $decimals).'G';
case 'M': return number_format($value / (float)(1 << 20), $decimals).'M';
case 'K': return number_format($value / (float)(1 << 10), $decimals).'K';