--- a/include/common-transit.inc.php +++ b/include/common-transit.inc.php @@ -4,17 +4,7 @@ 'saturday', 'weekday' ); -function getServiceOverride() { - global $conn; - $query = "Select * from calendar_dates where date = '".date("Ymd")."' and exception_type = '1'"; - debug($query,"database"); - $result = pg_query($conn, $query); - if (!$result) { - databaseError(pg_result_error($result)); - return Array(); - } - return pg_fetch_assoc($result); -} + function service_period() { @@ -33,5 +23,24 @@ return 'weekday'; } } +function midnight_seconds() +{ + // from http://www.perturb.org/display/Perlfunc__Seconds_Since_Midnight.html + if (isset($_SESSION['time'])) { + $time = strtotime($_SESSION['time']); + return (date("G", $time) * 3600) + (date("i", $time) * 60) + date("s", $time); + } + return (date("G") * 3600) + (date("i") * 60) + date("s"); +} +function midnight_seconds_to_time($seconds) +{ + if ($seconds > 0) { + $midnight = mktime(0, 0, 0, date("n") , date("j") , date("Y")); + return date("h:ia", $midnight + $seconds); + } + else { + return ""; + } +} +?> -?>