Re: Re: cvs: php-src(PHP_5_1) /ext/date php_date.c

From: Date: Fri, 07 Oct 2005 22:34:12 +0000
Subject: Re: Re: cvs: php-src(PHP_5_1) /ext/date php_date.c
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-19502@lists.php.net to get a copy of this message
On Fri, 7 Oct 2005, Nuno Lopes wrote:
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.
Can you check if in that case the elements in the struct that GetTimeZoneInformation fills are correct?
Yep, at least in my pc. I've removed the body of 'case TIME_ZONE_ID_UNKOWN', so that it could execute the STANDARD code, and it works fine. So this is the solution :)
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);
We can't use the _ things, because of thread safety, so we have to use the win32 api function.
Ah, ok, sorry...
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.
By all means, it's not working for 100% of the time. If we can improve it that's fine ofcourse. But +7/no DST should not be found as +8/DST... unless Windows fucks up again. Which windows are you using?
I'm using an up-to-date Windows XP Pro SP2. the problem is the lines like this:
{ "eet",   0,    2,  "Europe/Helsinki" },
{ "eest",  1,    3,  "Europe/Helsinki" },
So it will catch both (+2, no DST) and (+2 DST), when it should only catch the last. Acording to windows, (+2, no DST) should be 'Africa/Harare'. The same for (+7, no DST), that should be 'Asia/Bangkok'. Nuno P.S.: tomorrow or so I can try to generate a complete fallback map.

« previous php.internals (#19502) next »