cvs: pear /Date Date.php

From: Date: Sun, 11 May 2008 15:12:01 +0000
Subject: cvs: pear /Date Date.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-52297@lists.php.net to get a copy of this message
c01234 Sun May 11 15:12:01 2008 UTC Modified files: /pear/Date Date.php Log: Correcting error in Date::getTime() and Date::getDate() http://cvs.php.net/viewvc.cgi/pear/Date/Date.php?r1=1.93&r2=1.94&diff_format=u Index: pear/Date/Date.php diff -u pear/Date/Date.php:1.93 pear/Date/Date.php:1.94 --- pear/Date/Date.php:1.93 Sun May 11 14:55:09 2008 +++ pear/Date/Date.php Sun May 11 15:12:01 2008 @@ -43,7 +43,7 @@ * @copyright 1997-2007 Baba Buehler, Pierre-Alain Joye, Firman Wandayandi, C.A. Woodcock * @license http://www.opensource.org/licenses/bsd-license.php * BSD License - * @version CVS: $Id: Date.php,v 1.93 2008/05/11 14:55:09 c01234 Exp $ + * @version CVS: $Id: Date.php,v 1.94 2008/05/11 15:12:01 c01234 Exp $ * @link http://pear.php.net/package/Date */ @@ -1189,10 +1189,9 @@ $ret = $this->formatLikeStrftime("%Y%m%d%H%M%S"); break; case DATE_FORMAT_UNIXTIME: - if ($this->ob_invalidtime) { - $ret = $this->_getErrorInvalidTime(); - } else { - $ret = (string) $this->getTime(); + $ret = $this->getTime(); + if (!PEAR::isError($ret)) { + $ret = (string) $ret; } break; } @@ -3352,19 +3351,21 @@ */ function getTime() { - // Enter a time in UTC, so use 'gmmktime()' (the alternative - // is to offset additionally by the local time, but the object - // is not necessarily using local time): - // - return gmmktime($this->on_standardhour, - $this->on_standardminute, - $this->on_standardsecond, - $this->on_standardmonth, - $this->on_standardday, - $this->on_standardyear) - - $this->tz->getRawOffset() / 1000; // N.B. Unix-time excludes - // leap seconds by - // definition + if ($this->ob_invalidtime) { + $ret = $this->_getErrorInvalidTime(); + } else { + // Use 'gmmktime()' and offset result (to get UTC): + // + return gmmktime($this->on_standardhour, + $this->on_standardminute, + $this->on_standardsecond, + $this->on_standardmonth, + $this->on_standardday, + $this->on_standardyear) - + $this->tz->getRawOffset() / 1000; // N.B. Unix-time excludes + // leap seconds by + // definition + } }

« previous php.pear.cvs (#52297) next »