From a45235d39b5ed438a7a151ee93fc9411dfd38f55 Mon Sep 17 00:00:00 2001 From: Naomi Date: Fri, 13 Dec 2013 15:03:02 -0500 Subject: [PATCH] CC-5627 : Check all Application_Common_DateHelper calculations that use timezone --- airtime_mvc/application/models/Show.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Show.php b/airtime_mvc/application/models/Show.php index 2065ed425..9a7508082 100644 --- a/airtime_mvc/application/models/Show.php +++ b/airtime_mvc/application/models/Show.php @@ -1056,11 +1056,16 @@ SQL; /** * Calculates the percentage of a show scheduled given the start and end times in date/time format * and the time_filled as the total time the schow is scheduled for in time format. + * + * TODO when using propel properly this should be a method on the propel show instance model. **/ private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled) { - $durationSeconds = (strtotime($p_ends) - strtotime($p_starts)); - $time_filled = Application_Model_Schedule::WallTimeToMillisecs($p_time_filled) / 1000; + $utcTimezone = new DatetimeZone("UTC"); + $startDt = new DateTime($p_starts, $utcTimezone); + $endDt = new DateTime($p_ends, $utcTimezone); + $durationSeconds = intval($endDt->format("U")) - intval($startDt->format("U")); + $time_filled = Application_Common_DateHelper::playlistTimeToSeconds($p_time_filled); $percent = ceil(( $time_filled / $durationSeconds) * 100); return $percent;