From 577978db0c26fbdbbf67875063c292c97e286cf6 Mon Sep 17 00:00:00 2001 From: hugetoad Date: Thu, 29 Jan 2004 10:28:33 +0000 Subject: - special processing of unit 's' (Alexei) git-svn-id: svn://svn.zabbix.com/trunk@1216 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/include/config.inc.php | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'frontends/php/include') diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index a53797c0..9de998a3 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -64,6 +64,46 @@ function convert_units($value,$units,$multiplier) { +// Special processing for seconds + if($units=="s") + { + $ret=""; + + $t=floor($value/(365*24*3600)); + if($t>0) + { + $ret=$t."y"; + $value=$value-$t*(365*24*3600); + } + $t=floor($value/(30*24*3600)); + if($t>0) + { + $ret=$ret.$t."m"; + $value=$value-$t*(30*24*3600); + } + $t=floor($value/(24*3600)); + if($t>0) + { + $ret=$ret.$t."d"; + $value=$value-$t*(24*3600); + } + $t=floor($value/(3600)); + if($t>0) + { + $ret=$ret.$t."h"; + $value=$value-$t*(3600); + } + $t=floor($value/(60)); + if($t>0) + { + $ret=$ret.$t."m"; + $value=$value-$t*(60); + } + $ret=$ret.$value."s"; + + return $ret; + } + $u=""; $value=$value*pow(1024,(int)$multiplier); -- cgit