mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 00:25:06 +02:00
billing rewrite (disabling svn after)
git-svn-id: http://www.observium.org/svn/observer/trunk@2758 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+10
-2
@@ -460,14 +460,12 @@ function format_si($rate, $round = 2)
|
||||
if ($rate >= "0.1")
|
||||
{
|
||||
$sizes = Array('', 'k', 'M', 'G', 'T', 'P', 'E');
|
||||
# $round = Array('2','2','2','2','2','2','2','2','2');
|
||||
$ext = $sizes[0];
|
||||
for ($i = 1; (($i < count($sizes)) && ($rate >= 1000)); $i++) { $rate = $rate / 1000; $ext = $sizes[$i]; }
|
||||
}
|
||||
else
|
||||
{
|
||||
$sizes = Array('', 'm', 'u', 'n');
|
||||
# $round = Array('2','2','2','2');
|
||||
$ext = $sizes[0];
|
||||
for ($i = 1; (($i < count($sizes)) && ($rate != 0) && ($rate <= 0.1)); $i++) { $rate = $rate * 1000; $ext = $sizes[$i]; }
|
||||
}
|
||||
@@ -485,6 +483,16 @@ function format_bi($size, $round = '2')
|
||||
return round($size, $round).$ext;
|
||||
}
|
||||
|
||||
function format_number($value, $base = '1000', $round=2)
|
||||
{
|
||||
if($base == '1000')
|
||||
{
|
||||
return format_si($value, $round);
|
||||
} else {
|
||||
return format_bi($value, $round);
|
||||
}
|
||||
}
|
||||
|
||||
function is_valid_hostname($hostname)
|
||||
{
|
||||
// The Internet standards (Request for Comments) for protocols mandate that
|
||||
|
||||
Reference in New Issue
Block a user