On Tue, 13 Dec 2011, Oleg Oshmyan wrote:

> >> Which is why a pseudo-timezone called System is needed so that guesses
> >> do not have to be made. The extension would then convert
> >> /etc/localtime to its internal time zone description format or just
> >> use system-provided APIs as it used to do before PHP 5.1 if I
> >> understand correctly.
> >> 
> >>> That's a really bad idea, as we've discussed before on this list.
> > 
> > <snip>
> > 
> >> Perhaps I am a bad searcher; I would appreciate if you pointed me at 
> >> some of the past discussion.
> > 
> > http://marc.info/?t=119988823700001&r=1&w=2 is what it was I think.
> 
> Thanks. The thread was an interesting read but my suggestion is different
> from the one discussed there: I propose adding _one_ special time zone
> that will use the /etc/localtime file or system-provided APIs (only that
> time zone!), not using the /usr/share/zoneinfo directory instead of the
> built-in time zone database. So existing code would work just as before
> but in addition one could write

I suggest you lobby distributions that bundle PHP to add a post-install 
script for "dpkg-reconfigure tzdata" to drop a datetime.ini file in 
/etc/php5/conf.d with as contents "date.timezone=<newly selected 
timezone>". Using the information from /etc/localtime is *not* enough as 
you can't get the timezone identifier out of it.


>     date_default_timezone_set('System');
> 
> and get direct access to the system's own notion of local time, so e. g.
> 
>     date_default_timezone_set('System');
>     echo date('r');
> 
> would be equivalent to the C code
> 
>     char date[256];
>     time_t now = time(NULL);
>     strftime(date, 256, "%a, %d %b %Y %H:%M:%S %z", localtime(&now));
>     fputs(date, stdout);

That will never happen. The whole idea with the new support is to get 
*away* from OS idiosyncrasies and not adding more of them! PHP needs to 
be able to rely on its own bundled timezone database. Parsing files on 
the filesystem is slow and silly.

> Finally, a word on removing support for the TZ environment variable in
> particular: once again this makes good sense for server-side software but
> is bad for client-side software, as TZ is a standard way of telling
> software you launch which time zone you want it to work in.

TZ key values are not identical among operating systems, so that doesn't 
work.

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to