Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56444 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47572 invoked from network); 21 Nov 2011 01:41:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Nov 2011 01:41:23 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.153 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.153 smtp153.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.153] ([67.192.241.153:35746] helo=smtp153.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DE/07-31506-14CA9CE4 for ; Sun, 20 Nov 2011 20:41:22 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp15.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 29C3B3001E1 for ; Sun, 20 Nov 2011 20:41:18 -0500 (EST) X-Virus-Scanned: OK Received: by smtp15.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id CDE143001A0 for ; Sun, 20 Nov 2011 20:41:17 -0500 (EST) Message-ID: <4EC9AC3D.6090602@sugarcrm.com> Date: Sun, 20 Nov 2011 17:41:17 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: PHP Internals Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: datetime status From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! We're in RC now, and I'm very concerned about the status of DateTime functionality (see bugs 60236, 60237 and XFAILs) - I've reported these problems in June, but not much happened since then. I'm trying to figure out what's going on there, but I'm not sure if I understand the code correctly and if the fix is right. So far this is what I got: When parsing string "2010-11-06 18:38:28 EDT" with timelib_strtotime, I get back the correct datetime elements, and these for timezone: z = 300, tz_abbr = 0x2633670 "EDT", tz_info = 0x0, dst = 1, And from this and the code in do_adjust_timezone() I gather that "z" is supposed to be combined with "dst" when calculating timezone offsets. But timelib_unixtime2local() uses only "z" and ignores "dst" completely. So which one "z" is supposed to be? If it is the former, the patch seems to be pretty simple: --- lib/unixtime2tm.c (revision 319533) +++ lib/unixtime2tm.c (working copy) @@ -146,7 +146,7 @@ int z = tm->z; signed int dst = tm->dst; - timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60)); + timelib_unixtime2gmt(tm, tm->sse - (tm->z * 60) + tm->dst*3600); tm->z = z; tm->dst = dst; @@ -184,7 +184,7 @@ int z = tm->z; signed int dst = tm->dst; - timelib_unixtime2gmt(tm, ts - (tm->z * 60)); + timelib_unixtime2gmt(tm, (ts - (tm->z * 60) + tm->dst*3600)); tm->z = z; tm->dst = dst; It does not add any test breakage and fixes two XFAILs. Also, I see that sse value is not assigned here, though later the code goes: /* we need to reset the sse here as unixtime2gmt modifies it */ tm->sse = ts; Do we need to update sse in this branch too? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227