On Fri, 7 Oct 2005, Nuno Lopes wrote:

> > derick Wed Oct  5 07:06:57 2005 EDT
> >
> >  Modified files:              (Branch: PHP_5_1)
> >   /php-src/ext/date php_date.c
> >  Log:
> >  - Implement correct Windows timezone guessing.
>
> Thanks for you work, Derick!
> However after checking the correct TZ, you forgot to return it :)
>
> Something like the above will work:


Updated patch to cover all test cases @
http://mega.ist.utl.pt/~ncpl/php_date_win.txt

COmmitted with a minor change, please test. And thanks for the patch.

Derick

Uhm, sorry but it doesn't work well when I choose a timezone which has no DST. For an unknown reason, windows returns TIME_ZONE_ID_UNKOWN in that case, so PHP always returns UTC.

I've done some tests and the best way I found is simply (and removing the GetTimeZoneInformation() part): tzid = timelib_timezone_id_from_abbr("", (_daylight ? 3600 : 0) - _timezone, _daylight);

Those vars are defined in time.h (already included).
With this little piece of code I was able to get the correct date/time for 'Abu Dhabi' (+4, no DST). With the corrent code, UTC is returned.

There are also other problems:
Choosing 'Bangkok, Hanoi, Jakarta' (+7, no DST) leads to incorrect dates, because of the fallback table. It is recognised as 'Asia/Krasnoyarsk' (+8, DST), so it is always one hour advanced. So basically the second problem here is that the fallback table needs a big revision, to include all offsets, and to correct some no-DST timezones.


Nuno


P.S.: I know this isn't as exciting as Unicode, but its also about PHP :)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to