當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TTDate::getTimeOverLapDifference方法代碼示例

本文整理匯總了PHP中TTDate::getTimeOverLapDifference方法的典型用法代碼示例。如果您正苦於以下問題:PHP TTDate::getTimeOverLapDifference方法的具體用法?PHP TTDate::getTimeOverLapDifference怎麽用?PHP TTDate::getTimeOverLapDifference使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TTDate的用法示例。


在下文中一共展示了TTDate::getTimeOverLapDifference方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPartialPunchTotalTime

 function getPartialPunchTotalTime($in_epoch, $out_epoch, $total_time)
 {
     $retval = $total_time;
     if ($this->isActiveTime($in_epoch, $out_epoch) and $this->getIncludePartialPunch() == TRUE and ($this->getStartTime() > 0 or $this->getEndTime() > 0)) {
         Debug::text(' Checking for Active Time with: In: ' . TTDate::getDate('DATE+TIME', $in_epoch) . ' Out: ' . TTDate::getDate('DATE+TIME', $out_epoch), __FILE__, __LINE__, __METHOD__, 10);
         Debug::text(' Raw Start TimeStamp(' . $this->getStartTime(TRUE) . '): ' . TTDate::getDate('DATE+TIME', $this->getStartTime()) . ' Raw End TimeStamp: ' . TTDate::getDate('DATE+TIME', $this->getEndTime()), __FILE__, __LINE__, __METHOD__, 10);
         $start_time_stamp = TTDate::getTimeLockedDate($this->getStartTime(), $in_epoch);
         $end_time_stamp = TTDate::getTimeLockedDate($this->getEndTime(), $in_epoch);
         //Check if end timestamp is before start, if it is, move end timestamp to next day.
         if ($end_time_stamp < $start_time_stamp) {
             Debug::text(' Moving End TimeStamp to next day.', __FILE__, __LINE__, __METHOD__, 10);
             $end_time_stamp = $end_time_stamp + 86400;
         }
         $retval = 0;
         for ($i = $start_time_stamp - 86400; $i <= $end_time_stamp + 86400; $i += 86400) {
             $tmp_start_time_stamp = $i;
             $tmp_end_time_stamp = $tmp_start_time_stamp + ($end_time_stamp - $start_time_stamp);
             if ($this->isActiveTime($tmp_start_time_stamp, $tmp_end_time_stamp) == TRUE) {
                 $retval += TTDate::getTimeOverLapDifference($tmp_start_time_stamp, $tmp_end_time_stamp, $in_epoch, $out_epoch);
                 Debug::text(' Calculating partial time against Start TimeStamp: ' . TTDate::getDate('DATE+TIME', $tmp_start_time_stamp) . ' End TimeStamp: ' . TTDate::getDate('DATE+TIME', $tmp_end_time_stamp) . ' Total: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
             } else {
                 Debug::text(' Not Active on this day: ' . TTDate::getDate('DATE+TIME', $i), __FILE__, __LINE__, __METHOD__, 10);
             }
         }
     }
     Debug::text(' Partial Punch Total Time : ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
     return $retval;
 }
開發者ID:J-P-Hanafin,項目名稱:TimeTrex-1,代碼行數:28,代碼來源:PremiumPolicyFactory.class.php

示例2: getPartialPunchTotalTime

 function getPartialPunchTotalTime($in_epoch, $out_epoch, $total_time, $user_id)
 {
     $retval = $total_time;
     if ($this->isActiveTime($in_epoch, $out_epoch, $user_id) and $this->getIncludePartialPunch() == TRUE and ($this->getStartTime() > 0 or $this->getEndTime() > 0)) {
         Debug::text(' Checking for Active Time with: In: ' . TTDate::getDate('DATE+TIME', $in_epoch) . ' Out: ' . TTDate::getDate('DATE+TIME', $out_epoch), __FILE__, __LINE__, __METHOD__, 10);
         Debug::text(' Raw Start TimeStamp(' . $this->getStartTime(TRUE) . '): ' . TTDate::getDate('DATE+TIME', $this->getStartTime()) . ' Raw End TimeStamp(' . $this->getEndTime(TRUE) . '): ' . TTDate::getDate('DATE+TIME', $this->getEndTime()), __FILE__, __LINE__, __METHOD__, 10);
         $start_time_stamp = TTDate::getTimeLockedDate($this->getStartTime(), $in_epoch);
         $end_time_stamp = TTDate::getTimeLockedDate($this->getEndTime(), $in_epoch);
         //Check if end timestamp is before start, if it is, move end timestamp to next day.
         if ($end_time_stamp < $start_time_stamp) {
             Debug::text(' Moving End TimeStamp to next day.', __FILE__, __LINE__, __METHOD__, 10);
             $end_time_stamp = TTDate::getTimeLockedDate($this->getEndTime(), $end_time_stamp + 86400);
         }
         //Handle the last second of the day, so punches that span midnight like 11:00PM to 6:00AM get a full 1 hour for the time before midnight, rather than 59mins and 59secs.
         if (TTDate::getHour($end_time_stamp) == 23 and TTDate::getMinute($end_time_stamp) == 59) {
             $end_time_stamp = TTDate::getEndDayEpoch($end_time_stamp) + 1;
             Debug::text(' End time stamp is within the last minute of day, make sure we include the last second of the day as well.', __FILE__, __LINE__, __METHOD__, 10);
         }
         $retval = 0;
         for ($i = $start_time_stamp - 86400; $i <= $end_time_stamp + 86400; $i += 86400) {
             //Due to DST, we need to make sure we always lock time of day so its the exact same. Without this it can walk by one hour either way.
             $tmp_start_time_stamp = TTDate::getTimeLockedDate($this->getStartTime(), $i);
             $tmp_end_time_stamp = TTDate::getTimeLockedDate($end_time_stamp, $tmp_start_time_stamp + ($end_time_stamp - $start_time_stamp));
             //Use $end_time_stamp as it can be modified above due to being near midnight
             if ($this->isActiveTime($tmp_start_time_stamp, $tmp_end_time_stamp, $user_id) == TRUE) {
                 $retval += TTDate::getTimeOverLapDifference($tmp_start_time_stamp, $tmp_end_time_stamp, $in_epoch, $out_epoch);
                 Debug::text(' Calculating partial time against Start TimeStamp: ' . TTDate::getDate('DATE+TIME', $tmp_start_time_stamp) . ' End TimeStamp: ' . TTDate::getDate('DATE+TIME', $tmp_end_time_stamp) . ' Total: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
             } else {
                 Debug::text(' Not Active on this day: ' . TTDate::getDate('DATE+TIME', $i), __FILE__, __LINE__, __METHOD__, 10);
             }
         }
     }
     Debug::text(' Partial Punch Total Time: ' . $retval, __FILE__, __LINE__, __METHOD__, 10);
     return $retval;
 }
開發者ID:alachaum,項目名稱:timetrex,代碼行數:35,代碼來源:PremiumPolicyFactory.class.php


注:本文中的TTDate::getTimeOverLapDifference方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。