From 5bc838242b567687d39baeaf2321a35902220ff8 Mon Sep 17 00:00:00 2001 From: smos Date: Thu, 5 Aug 2010 09:18:45 +0200 Subject: Add 12 hour period starting from 8 in the morning. Thinking that would correspond better to human workdays. --- usr/local/www/status_rrd_graph.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'usr/local') diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index 97454c9..989269e 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -194,7 +194,7 @@ $ui_databases = array_merge($dbheader, $databases); $styles = array('inverse' => 'Inverse', 'absolute' => 'Absolute'); -$graphs = array("day", "week", "month", "quarter", "year", "4year"); +$graphs = array("12hour", "day", "week", "month", "quarter", "year", "4year"); $periods = array("current" => "Current Period", "previous" => "Previous Period"); $pgtitle = array("Status","RRD Graphs"); @@ -217,6 +217,18 @@ function get_dates($curperiod, $graph) { $offset = 0; } switch($graph) { + case "12hour": + switch($offset) { + case 0; + $houroffset = 0; + break; + default: + $houroffset = ($offset * 12) - 12; + break; + } + $start = mktime((8 + $houroffset), 0, 0, $curmonth, $curday, $curyear); + $end = mktime((8 + $houroffset) + 12, 0, 0, $curmonth, $curday, $curyear); + break; case "day": $start = mktime(0, 0, 0, $curmonth, ($curday + $offset), $curyear); $end = mktime(0, 0, 0, $curmonth, (($curday + $offset) + 1), $curyear); -- cgit v1.1