CC-5627 : Check all Application_Common_DateHelper calculations that use timezone
This commit is contained in:
parent
1dfcfd3e34
commit
a45235d39b
airtime_mvc/application/models
|
@ -1056,11 +1056,16 @@ SQL;
|
||||||
/**
|
/**
|
||||||
* Calculates the percentage of a show scheduled given the start and end times in date/time format
|
* 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.
|
* 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)
|
private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled)
|
||||||
{
|
{
|
||||||
$durationSeconds = (strtotime($p_ends) - strtotime($p_starts));
|
$utcTimezone = new DatetimeZone("UTC");
|
||||||
$time_filled = Application_Model_Schedule::WallTimeToMillisecs($p_time_filled) / 1000;
|
$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);
|
$percent = ceil(( $time_filled / $durationSeconds) * 100);
|
||||||
|
|
||||||
return $percent;
|
return $percent;
|
||||||
|
|
Loading…
Reference in New Issue