summaryrefslogtreecommitdiffstats
path: root/usr/local/www/status_rrd_graph_img.php
diff options
context:
space:
mode:
authorsmos <seth.mos@dds.nl>2010-07-15 20:43:49 +0200
committersmos <seth.mos@dds.nl>2010-07-15 20:43:49 +0200
commit0423bf2c65f75ff73d6a2b0007e949dc6f49ac66 (patch)
tree9924e81721b517e8139ba5dcfbef115221ca39ad /usr/local/www/status_rrd_graph_img.php
parent6a8cf738d6fc852773a9049c6728453ad5dbca9f (diff)
downloadpfsense-0423bf2c65f75ff73d6a2b0007e949dc6f49ac66.zip
pfsense-0423bf2c65f75ff73d6a2b0007e949dc6f49ac66.tar.gz
round the date calculation result so that it results in 1 month instead
of 4 weeks which looks strange.
Diffstat (limited to 'usr/local/www/status_rrd_graph_img.php')
-rw-r--r--usr/local/www/status_rrd_graph_img.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php
index 5000b5d..567d272 100644
--- a/usr/local/www/status_rrd_graph_img.php
+++ b/usr/local/www/status_rrd_graph_img.php
@@ -233,7 +233,7 @@ function timeDiff($time, $opt = array()) {
// Init an empty string
$str = '';
// To or From computation
- $diff = ($opt['to'] >= $time) ? $opt['to'] - $time : $time - $opt['to'];
+ $diff = ($opt['to'] > $time) ? $opt['to'] - $time : $time - $opt['to'];
// An array of label => periods of seconds;
$periods = array(
'decade' => 315569260,
@@ -250,11 +250,11 @@ function timeDiff($time, $opt = array()) {
if ($opt['precision'] != 'second')
$diff = round(($diff / $periods[$opt['precision']])) * $periods[$opt['precision']];
// Report the value is 'less than 1 ' precision period away
- (0 == $diff) && ($str = 'less than 1 ' .$opt['precision']);
+ (0 == $diff) && ($str = 'less than 1 ' . $opt['precision']);
// Loop over each period
foreach ($periods as $label => $value) {
// Stitch together the time difference string
- (($x = floor($diff / $value)) && $opt['parts']--) && $str .= ($str ? $opt['separator'] : '') . ($x .' '. $label. ($x > 1 ? 's' : ''));
+ (($x = round($diff / $value)) && $opt['parts']--) && $str .= ($str ? $opt['separator'] : '') . ($x .' '. $label. ($x > 1 ? 's' : ''));
// Stop processing if no more parts are going to be reported.
if ($opt['parts'] == 0 || $label == $opt['precision']) break;
// Get ready for the next pass
@@ -894,7 +894,7 @@ else {
/* check modification time to see if we need to generate image */
if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) {
- if((time() - filemtime("$rrdtmppath$curdatabase-$curgraph.png")) >= 55 ) {
+ if((time() - filemtime("$rrdtmppath$curdatabase-$curgraph.png")) >= 5 ) {
if($data)
exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
OpenPOWER on IntegriCloud