/** * Game end time, for comparison purposes. * */ function game_end_timestamp() { if (!$this->date_timestamp) { return 0; } # Calculate the game-end timestamp if ($this->game_end) { # TODO: doesn't handle games that cross midnight! list($start_hh, $start_mm) = split(':', $this->game_start); $start_decimal = $start_hh + $start_mm / 60; list($end_hh, $end_mm) = split(':', $this->game_end); $end_decimal = $end_hh + $end_mm / 60; $duration_ss = ($end_decimal - $start_decimal) * 3600; return $this->date_timestamp + $duration_ss; } return local_sunset_timestamp_for_date($this->date_timestamp); }
function local_sunset_for_date($timestamp) { return strftime('%H:%M', local_sunset_timestamp_for_date($timestamp)); }