} if ($ce) { $get_metric_string .= "&ce=" . rawurlencode($ce); } // Timestamps are used for graph zoom calculations $start_timestamp = null; $end_timestamp = null; if ($cs) { if (!is_numeric($cs)) { $start_timestamp = tzTimeToTimestamp($cs); } else { $start_timestamp = $cs; } if ($ce) { if (!is_numeric($ce)) { $end_timestamp = tzTimeToTimestamp($ce); } else { $end_timestamp = $ce; } } else { $end_timestamp = $start_timestamp - $conf['time_ranges'][$range]; } } else { $end_timestamp = time(); $start_timestamp = $end_timestamp - $conf['time_ranges'][$range]; } $data->assign("start_timestamp", $start_timestamp); $data->assign("end_timestamp", $end_timestamp); # Make some information available to templates. $data->assign("cluster_url", $cluster_url); $alt_view = make_alt_view($context, $clustername, $hostname, $get_metric_string);
function get_timestamp($time) { $timestamp = NULL; if ($time == "-now" || $time == "now") { $timestamp = time(); } else { if (preg_match("/\\-([0-9]*)(s)/", $time, $out)) { $timestamp = time() - $out[1]; } else { if (is_numeric($time)) { $timestamp = $time; } else { $timestamp = tzTimeToTimestamp($time); } } } return $timestamp; }