Re: Date methods simplified
| From: | Baba Buehler | Date: | Tue, 21 May 2002 22:12:26 +0000 |
| Subject: | Re: Date methods simplified | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6307@lists.php.net to get a copy of this message | ||
Nicolas Hoizey wrote:
Hi all, I'm looking at the Date package, and I wonder why addSeconds and substractSeconds are so big. I think addSeconds could be the following: function addSeconds($sec) {This would make Date only valid for dates that are representable in UNIXTIME format, roughly 1970-2038... one of the design goals of Date was a representation that worked for dates outside of the UNIXTIME range. If you were only going to use the UNIXTIME format alone, you'd be better off with the built-in PHP functions. Time in seconds is only used where absolutely required (daylight savings time information) and for compatability with other code that uses the "time-in-seconds" format. As to shortening/optimizing any of the methods... I'm sure there is room for improvement. Date is my "first pass" and I only focused on functionality. If you've got ideas/patches for improvements, please post them or send them to me. baba -- Baba Z Buehler <baba@BabaZ.com> http://BabaZ.com/ PGP KeyID: 0xA88A6D4C "Those who are willing to sacrifice freedom for security deserve neither." -Benjamin Franklin$this->setDate($this->getDate(DATE_FORMAT_UNIXTIME) + $sec, DATE_FORMAT_UNIXTIME);}