本文整理汇总了PHP中AgaviToolkit::floorDivide方法的典型用法代码示例。如果您正苦于以下问题:PHP AgaviToolkit::floorDivide方法的具体用法?PHP AgaviToolkit::floorDivide怎么用?PHP AgaviToolkit::floorDivide使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AgaviToolkit
的用法示例。
在下文中一共展示了AgaviToolkit::floorDivide方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOffsetRef
/**
* AgaviTimeZone API.
*
* @see AgaviTimeZone::getOffsetRef()
*
* @author Dominik del Bondio <ddb@bitxtender.com>
* @author The ICU Project
* @since 0.11.0
*/
public function getOffsetRef($date, $local, &$rawoff, &$dstoff)
{
// The check against finalMillis will suffice most of the time, except
// for the case in which finalMillis == DBL_MAX, date == DBL_MAX,
// and finalZone == 0. For this case we add "&& finalZone != 0".
if ($date >= $this->finalMillis && $this->finalZone !== null) {
$millis = 0;
$days = AgaviToolkit::floorDivide($date, AgaviDateDefinitions::MILLIS_PER_DAY, $millis);
$year = 0;
$month = 0;
$dom = 0;
$dow = 0;
AgaviCalendarGrego::dayToFields($days, $year, $month, $dom, $dow);
$rawoff = $this->finalZone->getRawOffset();
if (!$local) {
// Adjust from GMT to local
$date += $rawoff;
$days2 = AgaviToolkit::floorDivide($date, AgaviDateDefinitions::MILLIS_PER_DAY, $millis);
if ($days2 != $days) {
AgaviCalendarGrego::dayToFields($days2, $year, $month, $dom, $dow);
}
}
$dstoff = $this->finalZone->getOffset(AgaviGregorianCalendar::AD, $year, $month, $dom, $dow, $millis) - $rawoff;
return;
}
$secs = floor($date / AgaviDateDefinitions::MILLIS_PER_SECOND);
$transition = $this->findTransition($secs, $local);
$rawoff = $this->types[$transition['type']]['rawOffset'] * AgaviDateDefinitions::MILLIS_PER_SECOND;
$dstoff = $this->types[$transition['type']]['dstOffset'] * AgaviDateDefinitions::MILLIS_PER_SECOND;
}
示例2: handleGetMonthLength
/**
* @see AgaviCalendar::handleGetMonthLength
*
* @author Dominik del Bondio <ddb@bitxtender.com>
* @author The ICU Project
* @since 0.11.0
*/
protected function handleGetMonthLength($extendedYear, $month)
{
// If the month is out of range, adjust it into range, and
// modify the extended year value accordingly.
if ($month < 0 || $month > 11) {
$extendedYear += AgaviToolkit::floorDivide($month, 12, $month);
}
return $this->isLeapYear($extendedYear) ? self::$kLeapMonthLength[$month] : self::$kMonthLength[$month];
}
示例3: dayOfWeek
/**
* Return the day of week on the 1970-epoch day
*
* @param float day the 1970-epoch day (integral value)
*
* @return int the day of week
*
* @author Dominik del Bondio <dominik.del.bondio@bitextender.com>
* @author The ICU Project
* @since 1.0.1
*/
public static function dayOfWeek($day)
{
$dow = null;
AgaviToolkit::floorDivide($day + AgaviDateDefinitions::THURSDAY, 7, $dow);
return $dow == 0 ? AgaviDateDefinitions::SATURDAY : $dow;
}
示例4: testFloorDivideByZero
/**
* @expectedException PHPUnit_Framework_Error
*/
public function testFloorDivideByZero()
{
AgaviToolkit::floorDivide(10, 0, $rem);
}