[prev in list] [next in list] [prev in thread] [next in thread]
List: php-internals
Subject: Re: [PHP-DEV] [PATCH] new idate() - sunrise() - sunset() functions
From: Brian Foddy <brian.foddy () nwa ! com>
Date: 2003-02-06 22:49:39
[Download RAW message or body]
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 Rica
>
>
>
>>sunrise() - sunset() functions
>>
>>
>>
>
>__________________________________________________
>Do you Yahoo!?
>Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
>http://mailplus.yahoo.com
>
>
>
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic