diff options
| author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2004-01-29 10:28:33 +0000 |
|---|---|---|
| committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2004-01-29 10:28:33 +0000 |
| commit | 577978db0c26fbdbbf67875063c292c97e286cf6 (patch) | |
| tree | fcda6953edfed3389448f44ba25849c3b3a0d49d /frontends/php/include | |
| parent | 020b3b2440eb7a7a950f192409bb3e5343a85d1f (diff) | |
| download | zabbix-577978db0c26fbdbbf67875063c292c97e286cf6.tar.gz zabbix-577978db0c26fbdbbf67875063c292c97e286cf6.tar.xz zabbix-577978db0c26fbdbbf67875063c292c97e286cf6.zip | |
- special processing of unit 's' (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@1216 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/config.inc.php | 40 |
1 files changed, 40 insertions, 0 deletions
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); |
