Re: [PATCH] new idate() - sunrise() - sunset() functions
| From: | Brian Foddy | Date: | Thu, 06 Feb 2003 22:49:39 +0000 |
| Subject: | Re: [PATCH] new idate() - sunrise() - sunset() functions | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-94083@lists.php.net to get a copy of this message | ||
I would be very interested. And not just for PHP, tho I
would like to see a PHP function for it.
We have several apps that are currently obtaining the GMT offset
the old-fashion way.
1. Set the TZ=GMT, perform a mktime call.
2. Set TZ to local timezone, perform the same mktime call.
3. Subtract the 2 timestamps.
4. Reset TZ back to its standard value.
If you properly set the dst param, the result will be the
time difference between the two timezones for whatever
date/time you want.
As ugly as this seems (and I do agree its ugly), it actually
works very well, stable, and performs pretty fast. Our apps
perform this sequence tens of thousands times per day at least.
I always felt if I "had the time" I'd try and re-write it
to do something along the same you describe, but never got
there.
Brian
David Gillies wrote:
In a similar itch-scratching moment I whipped up a trivial PHP module that groks tzfile timezone files to give you the offset from GMT at any time in the Unix epoch. I needed this to preflight a bunch of data which had been gathered with a lot of disparate time zones into a single UTC version, but I thought it might merit further dissemination. Anyone interested? Best Wishes David Gillies San Jose Costa Ricasunrise() - sunset() functions__________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com