/** * Get duration (considering only open hours) elapsed bewteen two given DateTimes * @param $oTicket Ticket The ticket for which to compute the duration * @param $oStartDate DateTime The starting point for the computation (default = now) * @param $oEndDate DateTime The ending point for the computation (default = now) * @return integer The duration (number of seconds) of open hours elapsed between the two dates */ public static function GetOpenDuration($oTicket, DateTime $oStartDate, DateTime $oEndDate) { if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __CLASS__ . '::' . __FUNCTION__); } return abs($oEndDate->format('U') - $oStartDate->format('U')); }
/** * Get duration (considering only open hours) elapsed bewteen two given DateTimes * @param $oObject DBObject The object for which to compute the duration * @param $oStartDate DateTime The starting point for the computation (default = now) * @param $oEndDate DateTime The ending point for the computation (default = now) * @return integer The duration (number of seconds) of open hours elapsed between the two dates */ public function GetOpenDuration($oObject, DateTime $oStartDate, DateTime $oEndDate) { if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::Trace(WorkingTimeRecorder::TRACE_DEBUG, __CLASS__ . '::' . __FUNCTION__); } //echo "GetOpenDuration - default: ".$oStartDate->format('Y-m-d H:i:s')." to ".$oEndDate->format('Y-m-d H:i:s')."<br/>\n"; $iDuration = abs($oEndDate->format('U') - $oStartDate->format('U')); if (class_exists('WorkingTimeRecorder')) { WorkingTimeRecorder::SetValues($oStartDate->format('U'), $oEndDate->format('U'), $iDuration, WorkingTimeRecorder::COMPUTED_DURATION); } return $iDuration; }