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

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

Reply via email to