derick Sat Oct 1 11:07:21 2005 EDT
Modified files:
/php-src/ext/date php_date.c
/php-src/ext/date/lib fallbackmap.h timezonemap.h .cvsignore
parse_date.c timelib.h timelib_structs.h
/php-src/ext/date/lib/resource parse_date.re
/php-src/ext/date/tests date_default_timezone_get-1.phpt
date_default_timezone_set-1.phpt
Log:
- MF51: Implemented better timezone guessing algorithm.
With this new code, I've implemented the "magic" timezone guessing for
windows. The tzname doesn't become correct, because the windows' tz names
aren't in the php db, but at least the offset/dst settings become correct.
Patch: http://mega.ist.utl.pt/~ncpl/php_date_windows.txt
BTW, why is this change needed? :
+/* $Id: php_date.c,v 1.43.2.6 2005/10/01 15:04:02 derick Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -265,7 +265,7 @@
}
/* Check environment variable */
env = getenv("TZ");
- if (env && *env) {
+ if (env && *env && strlen(env)) {
return env;
}
'*env 'and 'strlen(env)' do the same here, and *env is much more efficient
(and gcc is very lazy when working without the -Ox flags..).
Also, the zone_search() function could use a special binary search to detect
the first occurence of the specified tz, instead of walking through the
whole array (do you want a patch for that?).
Nuno
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php