Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56866 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95735 invoked from network); 11 Dec 2011 00:59:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2011 00:59:52 -0000 Authentication-Results: pb1.pair.com header.from=chortos@inbox.lv; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=chortos@inbox.lv; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain inbox.lv designates 89.111.3.82 as permitted sender) X-PHP-List-Original-Sender: chortos@inbox.lv X-Host-Fingerprint: 89.111.3.82 shark2.inbox.lv Received: from [89.111.3.82] ([89.111.3.82:40844] helo=shark2.inbox.lv) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/81-15360-58004EE4 for ; Sat, 10 Dec 2011 19:59:50 -0500 Received: from mail.inbox.lv (pop [10.0.1.110]) by shark2-plain.inbox.lv (Postfix) with ESMTP id 623A68525 for ; Sun, 11 Dec 2011 02:59:46 +0200 (EET) Received: from [192.168.1.139] (unknown [77.38.233.95]) (Authenticated sender: chortos@inbox.lv) by mail.inbox.lv (Postfix) with ESMTPSA id 49C861CF65 for ; Sun, 11 Dec 2011 02:59:45 +0200 (EET) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 11 Dec 2011 02:59:45 +0200 Message-ID: To: internals@lists.php.net Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-Virus-Scanned: OK Subject: Local time zone From: chortos@inbox.lv (Oleg Oshmyan) 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/