import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Date
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @version $Id: DateObject.php 11954 2008-10-14 17:27:50Z thomas $
* @version $Id: DateObject.php 14117 2009-02-19 21:29:17Z thomas $
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
@ -144,7 +144,7 @@ abstract class Zend_Date_DateObject {
*/
protected function mktime($hour, $minute, $second, $month, $day, $year, $gmt = false)
{
// complete date but in 32bit timestamp - use PHP internal
if ((1901 < $year) and ($year < 2038)) {
@ -534,12 +534,12 @@ abstract class Zend_Date_DateObject {
break;
case 'O': // difference to GMT in hours
$gmtstr = ($gmt === true) ? 0 : $this->_offset;
$gmtstr = ($gmt === true) ? 0 : $this->getGmtOffset();
$output .= sprintf('%s%04d', ($gmtstr <= 0) ? '+' : '-', abs($gmtstr) / 36);
break;
case 'P': // difference to GMT with colon
$gmtstr = ($gmt === true) ? 0 : $this->_offset;
$gmtstr = ($gmt === true) ? 0 : $this->getGmtOffset();
$gmtstr = sprintf('%s%04d', ($gmtstr <= 0) ? '+' : '-', abs($gmtstr) / 36);
$output = $output . substr($gmtstr, 0, 3) . ':' . substr($gmtstr, 3);
break;
@ -555,13 +555,13 @@ abstract class Zend_Date_DateObject {
break;
case 'Z': // timezone offset in seconds
$output .= ($gmt === true) ? 0 : -$this->_offset;
$output .= ($gmt === true) ? 0 : -$this->getGmtOffset();
break;
// complete time formats
case 'c': // ISO 8601 date format
$difference = $this->_offset;
$difference = $this->getGmtOffset();
$difference = sprintf('%s%04d', ($difference <= 0) ? '+' : '-', abs($difference) / 36);
$output .= $date['year'] . '-'
. (($date['mon'] < 10) ? '0' . $date['mon'] : $date['mon']) . '-'
@ -573,7 +573,7 @@ abstract class Zend_Date_DateObject {
break;
case 'r': // RFC 2822 date format
$difference = $this->_offset;
$difference = $this->getGmtOffset();
$difference = sprintf('%s%04d', ($difference <= 0) ? '+' : '-', abs($difference) / 36);
$output .= gmdate('D', 86400 * (3 + self::dayOfWeek($date['year'], $date['mon'], $date['mday']))) . ', '
. (($date['mday'] < 10) ? '0' . $date['mday'] : $date['mday']) . ' '
@ -895,10 +895,10 @@ abstract class Zend_Date_DateObject {
if (abs($this->_unixTimestamp) <= 0x7FFFFFFF) {
if ($rise === false) {
return date_sunset($this->_unixTimestamp, SUNFUNCS_RET_TIMESTAMP, $location['latitude'],
$location['longitude'], 90 + $horizon, $this->_offset / 3600);
$location['longitude'], 90 + $horizon, $this->getGmtOffset() / 3600);
}
return date_sunrise($this->_unixTimestamp, SUNFUNCS_RET_TIMESTAMP, $location['latitude'],
$location['longitude'], 90 + $horizon, $this->_offset / 3600);
$location['longitude'], 90 + $horizon, $this->getGmtOffset() / 3600);
}
// self calculation - timestamp bigger than 32bit
@ -1014,6 +1014,8 @@ abstract class Zend_Date_DateObject {
if (($zone == 'UTC') or ($zone == 'GMT')) {
$this->_dst = false;
} else {
$this->_dst = true;
}
return $this;
@ -1039,6 +1041,17 @@ abstract class Zend_Date_DateObject {
*/
public function getGmtOffset()
{
return $this->_offset;
$date = $this->getDateParts($this->getUnixTimestamp(), true);
$zone = @date_default_timezone_get();
$result = @date_default_timezone_set($this->_timezone);
if ($result === true) {
$offset = $this->mktime($date['hours'], $date['minutes'], $date['seconds'],
$date['mon'], $date['mday'], $date['year'], false)
- $this->mktime($date['hours'], $date['minutes'], $date['seconds'],
$date['mon'], $date['mday'], $date['year'], true);
}
date_default_timezone_set($zone);
return $offset;
}
}