PHP is used for server-side software that needs to use the remote client's time zone and for distributed software potentially running on geographically dispersed servers that needs to use a common time zone, and in these cases there is no doubt that the time zone should be manually specified and that the default should be universally constant if it exists at all. However, PHP is also used for utilities that people run on their personal machines, and in most cases they _want_ to use the current system time zone, whatever it is. PHP 5.3 provides a way to at least guess the current system time zone:
date_default_timezone_set(@date_default_timezone_get()); PHP 5.4, as currently planned, removes this ability and does not add any other way to get the system time zone. First, let me ask: is this right or does another way exist? Second, if no other way exists, I urge that the guessing algorithm is added back in or split out into a separate function, say, date_system_timezone_get. Third, I propose improvements to the guessing algorithm on UNIX: * The tzname C variable can be used to get two abbreviations for the current zone (typically the standard one and the DST one for zones where DST is used), which allows to improve the guess compared to using just one abbreviation; for example, the time zone in London in winter will be guessed as Europe/London rather than UTC. * /etc/localtime is often a symbolic link to or a copy of /usr/share/zoneinfo/<time zone identifier>. In this case this time zone identifier can be considered another candidate just like the values of date.timezone and TZ. * This requires more effort, but ideally PHP should just have a special time zone named something like 'System' that would use /etc/localtime instead of any built-in time zone data, just like the localtime C function does when the TZ environment variable is empty. I am willing to work on patches but I suppose some consensus should be reached first. -- Oleg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php