$_REQUEST['hour'] = $hour;
    $_REQUEST['minute'] = $minute;
    $_REQUEST['numhours'] = $numhours;
} else {
    # Called with year/month/day hour:minute, or with nothing. In the latter case, we default to last 2 hours
    $timestart = now() - 2 * 3600;
    ###### KISKA TIME ################################################
    list($year, $month, $day, $hour, $minute) = epoch2YmdHM($timestart);
    $year = !isset($_REQUEST['year']) ? $year : $_REQUEST['year'];
    $month = !isset($_REQUEST['month']) ? $month : $_REQUEST['month'];
    $day = !isset($_REQUEST['day']) ? $day : $_REQUEST['day'];
    $hour = !isset($_REQUEST['hour']) ? $hour : $_REQUEST['hour'];
    $minute = !isset($_REQUEST['minute']) ? $minute : $_REQUEST['minute'];
    $minute = floorminute($minute);
    $numhours = !isset($_REQUEST['numhours']) ? 2 : $_REQUEST['numhours'];
    $starttime = str2epoch("{$year}/{$month}/{$day} {$hour}:{$minute}:00");
    $starthour = ($timenow - $starttime) / 3600;
    $endhour = ($timenow - $starttime) / 3600 - $numhours;
}
# Degugging
if ($debugging == 1) {
    #var_dump($_REQUEST);
    var_dump($_GET);
    foreach ($subnetsToUse as $thisSubnet) {
        print "<p>subnet={$thisSubnet}</p>\n";
    }
    print "<p>Mosaic time: {$year}/{$month}/{$day} {$hour}:{$minute}</p>\n";
    print "<p>Current time: {$currentYear}/{$currentMonth}/{$currentDay} {$currentHour}:{$currentMinute}</p>\n";
    print "<p><a href=" . curPageURL() . ">url=" . curPageURL() . "</a></p>\n";
    echo "<hr/>\n";
}
function diagnosticTable($subnet, $year, $month, $day, $hour, $minute, $numhours, $plotsPerRow, $WEBPLOTS, $includeHeader)
{
    $timenow = now();
    #################### KISKA TIME #########################
    # generate the epoch time for the start date/time requested
    #$starttime = mktime($hour, $minute, 0, $month, $day, $year); # get local/utc conversion issues
    $starttime = str2epoch("{$year}/{$month}/{$day} {$hour}:{$minute}:00");
    # work out the difference in seconds
    $starthour = ($timenow - $starttime) / 3600;
    $endhour = ($timenow - $starttime) / 3600 - $numhours;
    #if ($starthour < 0) {
    #	$starthour = 0;
    #}
    #if ($endhour < 0) {
    #	$endhour = 0;
    #}
    $numMins = 10;
    #$starttime = now() - $starthour * 60 * 60 ;
    #list ($year, $month, $day, $hour, $minute) = epoch2YmdHM($starttime);
    $stoptime = now() - $endhour * 60 * 60;
    list($year_stop, $month_stop, $day_stop, $hour_stop, $minute_stop) = epoch2YmdHM($stoptime);
    list($year_now, $month_now, $day_now, $hour_now, $minute_now) = epoch2YmdHM($timenow);
    $webpagetitle = sprintf("%s %4d/%02d/%02d %02d:%02d", $subnet, $year, $month, $day, $hour, $minute);
    if ($includeHeader) {
        printf("<h1 title=\"The start date/time of the spectrogram mosaic (UTC)\" align=\"center\">%s %4d/%02d/%02d %02d:%02d (%dh %02dm ago)</h1>\n", $subnet, $year, $month, $day, $hour, $minute, $starthour, 60 * $starthour % 60);
    } else {
        printf("<h1 title=\"Start: %4d/%02d/%02d %02d:%02d UTC (%dh %02dm ago)\" align=\"center\">%s</h1>\n", $year, $month, $day, $hour, $minute, $starthour, 60 * $starthour % 60, $subnet);
    }
    echo "<table class=\"center\" border=1>\n";
    $c = 0;
    $latestAge = "?";
    $firstRow = 1;
    $oldhhmm = "";
    for ($time = $starttime + $numMins * 60; $time < $stoptime; $time += $numMins * 60) {
        # Get the end date and time for the current image
        list($year, $month, $day, $hour, $minute) = epoch2YmdHM($time);
        $floorminute = floorminute($minute);
        $timestamp = sprintf("%04d%02d%02dT%02d%02d", $year, $month, $day, $hour, $floorminute) . "00";
        # Create labels for end hour/minute
        $hhmm = sprintf("%02d:%02d", $hour, $floorminute);
        # Get the start date and time for the current image
        list($syear, $smonth, $sday, $shour, $sminute) = epoch2YmdHM($time - $numMins * 60);
        $floorsminute = floorminute($sminute);
        # Create labels for start hour/minute
        $rowstarthhmm = sprintf("%02d:%02d", $shour, $floorsminute);
        date_default_timezone_set('UTC');
        $floorepochUTC = mktime($shour, $sminute, 0, $smonth, $sday, $syear);
        date_default_timezone_set('US/Alaska');
        $localtime = localtime($floorepochUTC, true);
        # Cannot just use time (see above vairable) here since it is now "floored"
        $rowstartlocalhhmm = sprintf("%4d/%02d/%02d %02d:%02d", $localtime[tm_year] + 1900, $localtime[tm_mon] + 1, $localtime[tm_mday], $localtime[tm_hour], $localtime[tm_min]);
        if ($oldhhmm == "") {
            $oldhhmm = $rowstarthhmm . " - ";
        }
        # work out age of this latest data in this image
        if ($timenow - $time < 24 * 60 * 60) {
            $now = strtotime("{$year_now}-{$month_now}-{$day_now} {$hour_now}:{$minute_now}:00");
            $tim = strtotime("{$year}-{$month}-{$day} {$hour}:{$floorminute}:00");
            $ageSecs = $now - $tim;
            $ageHours = floor($ageSecs / 3600);
            $ageMins = floor(($ageSecs - 3600 * $ageHours) / 60);
            $ageStr = sprintf("%dh%02dm", $ageHours, $ageMins);
            if ($ageSecs < 0) {
                $ageHours = floor(-$ageSecs / 3600);
                $ageMins = floor((-$ageSecs - 3600 * $ageHours) / 60);
                $ageStr = sprintf("-%dh%02dm", $ageHours, $ageMins);
            }
        }
        # (ROW STARTS HERE)
        if ($c % $plotsPerRow == 0) {
            $rowFinished = 0;
            #echo "<br/>\n";
            if ($firstRow == 0) {
                echo "<tr class=\"mosaicblankrow\"><td>&nbsp;</td></tr>\n";
            } else {
                $firstRow = 0;
            }
            $summarymessage = summarystations($stachans);
            echo "<tr><td height=198 title=\"Start time for this row (UTC). Local time is {$rowstartlocalhhmm}\">{$rowstarthhmm}</td><td>{$summarymessage}</td>\n";
        }
        # CELL STARTS HERE
        $summaryfile = "{$WEBPLOTS}/{$subnet}/{$year}/{$month}/{$day}/{$timestamp}.txt";
        if (file_exists($summaryfile)) {
            list($stachans, $percentages, $bitranges, $modefractions, $numuniquevalues) = loadsummaryfile($summaryfile);
            $summarymessage = summarymessage($stachans, $percentages, $bitranges, $modefractions, $numuniquevalues);
            $latestAge = $ageStr;
            #echo "<td width=151 title=\"$oldhhmm$hhmm\" class=\"tdimg\"><a href=$summaryfile target=\"diagnostic\">$summarymessage</a></td>\n";
            echo "<td width=151 title=\"{$oldhhmm}{$hhmm}\" ><a href={$summaryfile} target=\"diagnostic\">{$summarymessage}</a></td>\n";
        } else {
            echo "<td width=151 title=\"{$oldhhmm}{$hhmm}\">NO DATA</td>\n";
        }
        # CELL ENDS HERE
        if ($c % $plotsPerRow == $plotsPerRow - 1) {
            # ROW ENDS HERE
            date_default_timezone_set('UTC');
            $floorepochUTC = mktime($hour, $minute, 0, $month, $day, $year);
            date_default_timezone_set('US/Alaska');
            $localtime = localtime($floorepochUTC, true);
            # Cannot just use time (see above vairable) here since it is now "floored"
            $rowendlocalhhmm = sprintf("%4d/%02d/%02d %02d:%02d", $localtime[tm_year] + 1900, $localtime[tm_mon] + 1, $localtime[tm_mday], $localtime[tm_hour], $localtime[tm_min]);
            echo "<td height=198 title=\"End time for this row (UTC). Local time is {$rowendlocalhhmm}\">{$hhmm}</td>\n";
            $rowFinished = 1;
        }
        $c++;
        $oldhhmm = "{$hhmm} - ";
    }
    if ($rowFinished == 0) {
        echo "<td></td></tr>\n";
    }
    echo "</table>\n";
    if ($includeHeader) {
        printf("<h1 title=\"The end date/time of the spectrogram mosaic (UTC)\" align=\"center\">%s %4d/%02d/%02d %02d:%02d (%dh %02dm ago)</h1>\n", $subnet, $year, $month, $day, $hour, $minute, $endhour, 60 * $endhour % 60);
    }
    $webpagetitle .= sprintf("- %4d/%02d/%02d %02d:%02d", $year, $month, $day, $hour, $minute);
    return $webpagetitle;
}