summaryrefslogtreecommitdiffstats
path: root/usr/local
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
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')
-rwxr-xr-xusr/local/www/status_rrd_graph.php4
-rw-r--r--usr/local/www/status_rrd_graph_img.php8
2 files changed, 6 insertions, 6 deletions
diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php
index b467d8a..115d12c 100755
--- a/usr/local/www/status_rrd_graph.php
+++ b/usr/local/www/status_rrd_graph.php
@@ -197,11 +197,11 @@ function get_dates($curperiod, $graph) {
break;
case "year":
$start = mktime(0, 0, 0, 1, 0, ($curyear + $offset));
- $end = mktime(0, 0, 0, 1, 1, (($curyear + $offset) +1));
+ $end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1));
break;
case "4year":
$start = mktime(0, 0, 0, 1, 0, (($curyear - 3) + $offset));
- $end = mktime(0, 0, 0, 1, 1, (($curyear + $offset) +1));
+ $end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1));
break;
}
// echo "start $start ". date('l jS \of F Y h:i:s A', $start) .", end $end ". date('l jS \of F Y h:i:s A', $end) ."<br>";
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