mirror of
https://github.com/unraid/webgui.git
synced 2026-05-01 23:39:21 -05:00
Merge branch 'master' of github.com:limetech/dynamix-6.2
This commit is contained in:
@@ -21,14 +21,14 @@ function my_scale($value, &$unit, $decimals = NULL) {
|
||||
$dot = substr($number,0,1);
|
||||
$comma = substr($number,1,1);
|
||||
$units = array('B','KB','MB','GB','TB','PB');
|
||||
if ($scale==0 && $decimals==NULL) {
|
||||
if ($scale==0 && $decimals===NULL) {
|
||||
$decimals = 0;
|
||||
$unit = '';
|
||||
} else {
|
||||
$base = $value ? floor(log($value, 1000)) : 0;
|
||||
if ($scale>0 && $base>$scale) $base = $scale;
|
||||
$value /= pow(1000, $base);
|
||||
if ($decimals==NULL) $decimals = $value>=100 ? 0 : ($value>=10 ? 1 : (round($value*100)%100==0 ? 0 : 2));
|
||||
if ($decimals===NULL) $decimals = $value>=100 ? 0 : ($value>=10 ? 1 : (round($value*100)%100==0 ? 0 : 2));
|
||||
if ($scale<0 && round($value,$decimals)==1000) { $value = 1; $base++; }
|
||||
$unit = $units[$base];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user