diff options
| author | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-30 07:29:51 +0000 |
|---|---|---|
| committer | alex <alex@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-10-30 07:29:51 +0000 |
| commit | b91817b23f031697fd307b6a793bb5de284331d1 (patch) | |
| tree | 2692455229faef1b6b62618004026f1305e1fbf4 | |
| parent | 0cd27c148e3918d42cf8fd0080a0a8234a8825ec (diff) | |
| download | zabbix-b91817b23f031697fd307b6a793bb5de284331d1.tar.gz zabbix-b91817b23f031697fd307b6a793bb5de284331d1.tar.xz zabbix-b91817b23f031697fd307b6a793bb5de284331d1.zip | |
- better processing of units 's', support for units 'uptime' (Alexei)
git-svn-id: svn://svn.zabbix.com/trunk@3397 97f52cf1-0a1b-0410-bd0e-c28be96e8082
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | frontends/php/include/config.inc.php | 31 |
2 files changed, 31 insertions, 1 deletions
@@ -12,6 +12,7 @@ Changes for 1.3: Integrated from 1.1.x + - better processing of units 's', support for units 'uptime' (Alexei) - fixed calculation of nodata() (Alexei) - fixed occasional LIBSQLORA8-30002: Memory allocation error. (Alexei) - fixed system.swap.in[] and system.swap.out[] under Linux 2.4 (Alexei) diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index b4bc5364..75ce2fb2 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -170,6 +170,35 @@ function SDI($msg="SDI") { echo "DEBUG INFO: "; if(is_array($msg)) print_r($msg) $ret=date("Y.m.d H:i:s",$value); return $ret; } +//Special processing of uptime + if($units=="uptime") + { + $ret=""; + $days=floor($value/(24*3600)); + if($days>0) + { + $value=$value-$days*(24*3600); + } + $hours=floor($value/(3600)); + if($hours>0) + { + $value=$value-$hours*3600; + } + $min=floor($value/(60)); + if($min>0) + { + $value=$value-$min*(60); + } + if($days==0) + { + $ret = sprintf("%02d:%02d:%02d", $hours, $min, $value); + } + else + { + $ret = sprintf("%d days, %02d:%02d:%02d", $days, $hours, $min, $value); + } + return $ret; + } // Special processing for seconds if($units=="s") { @@ -205,7 +234,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: "; if(is_array($msg)) print_r($msg) $ret=$ret.$t."m"; $value=$value-$t*(60); } - $ret=$ret.$value."s"; + $ret=$ret.round($value)."s"; return $ret; } |
