summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/config.inc.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-01-07 23:01:34 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-01-07 23:01:34 +0000
commit251bd866e2a64a90009799a20dcd9406e34b9b95 (patch)
tree0c4515de6c72bf73e5ca1d45e33fa813dcd4936b /frontends/php/include/config.inc.php
parent86d9c9e82f10c2c89a58ed3785c6b00a1bf5bc85 (diff)
downloadzabbix-251bd866e2a64a90009799a20dcd9406e34b9b95.tar.gz
zabbix-251bd866e2a64a90009799a20dcd9406e34b9b95.tar.xz
zabbix-251bd866e2a64a90009799a20dcd9406e34b9b95.zip
- special processing of 'b' (bytes). Take 1000 for Kilos (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@1591 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/config.inc.php')
-rw-r--r--frontends/php/include/config.inc.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 4aa07b0f..5b9a3f0b 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -94,6 +94,44 @@
$u="";
+// Special processing for bits (kilo=1000, not 1024 for bits)
+ if($units=="b")
+ {
+ $abs=abs($value);
+
+ if($abs<1000)
+ {
+ $u="";
+ }
+ else if($abs<1000*1000)
+ {
+ $u="K";
+ $value=$value/1000;
+ }
+ else if($abs<1000*1000*1000)
+ {
+ $u="M";
+ $value=$value/(1000*1000);
+ }
+ else
+ {
+ $u="G";
+ $value=$value/(1000*1000*1000);
+ }
+
+ if(round($value)==$value)
+ {
+ $s=sprintf("%.0f",$value);
+ }
+ else
+ {
+ $s=sprintf("%.2f",$value);
+ }
+
+ return "$s $u$units";
+ }
+
+
if($units=="")
{
if(round($value)==$value)