<body>

<?php 
# global variables
$debugging = 1;
$scriptname = scriptname();
# Set date/time now
$timenow = now();
################# KISKA TIME ####################
$currentYear = epoch2str($timenow, "%Y");
$currentMonth = epoch2str($timenow, "%m");
$currentDay = epoch2str($timenow, "%d");
$currentHour = epoch2str($timenow, "%H");
$currentMinute = epoch2str($timenow, "%i");
$currentMinute = epoch2str($timenow, "%M");
$currentSec = epoch2str($timenow, "%S");
# Set convenience variables from CGI parameters
if (isset($_REQUEST['starthour']) && isset($_REQUEST['endhour'])) {
    # Called with starthour, endhour
    # Although this script will accept URL variables starthour and endhour, here we translate them into
    # year/month/day hour:minute, and we also change the URL PHP thinks this page has, so posts real time to log posts
    $starthour = $_REQUEST['starthour'];
    $endhour = !isset($_REQUEST['endhour']) ? 0 : $_REQUEST['endhour'];
    if ($starthour < $endhour) {
        $tmphour = $endhour;
        $endhour = $starthour;
        $starthour = $tmphour;
    }
    $timestart = now() - $starthour * 3600;
    ###### KISKA TIME ################################################
    list($year, $month, $day, $hour, $minute) = epoch2YmdHM($timestart);
function epoch2YmdHM($e)
{
    $numMins = 10;
    $year = epoch2str($e, "%Y", "UTC");
    $month = epoch2str($e, "%m", "UTC");
    $day = epoch2str($e, "%d", "UTC");
    $hour = epoch2str($e, "%H", "UTC");
    $minute = epoch2str($e, "%M", "UTC");
    return array($year, $month, $day, $hour, $minute);
}