Re: [PHP-DEV] date_diff broken?

2011-06-18 Thread Derick Rethans
On Fri, 17 Jun 2011, Stas Malyshev wrote: Hi! Does it mean that all the tests Daniel added should work now? http://news.php.net/php.cvs/65174 Looks like ts-date conversion is broken on TLA timezones. Try: ?php $t = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2 $ts =

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Richard Quadling
On 17 June 2011 00:51, Stas Malyshev smalys...@sugarcrm.com wrote: Hi! I've been looking into various tests and discovered something strange in date_diff. Example code: ?php $start = new DateTime('2010-10-04 02:18:48 EDT'); $end   = new DateTime('2010-11-06 18:38:28 EDT'); $int =

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Derick Rethans
On Fri, 17 Jun 2011, Richard Quadling wrote: On 17 June 2011 00:51, Stas Malyshev smalys...@sugarcrm.com wrote: As you can see, the date in $start changed, even though it shouldn't happen. Looks like it's because of timelib_diff() which has this:    timelib_apply_localtime(one, 0);  

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Stas Malyshev
Hi! If either of the dates use a TLA timezone (EDT, PST, GMT), rather than the long name (Europe/London, Indian/Kerguelen, America/Kentucky/Louisville), then that date is altered. Yes, this seems to be because TLA ones rely on -z and -dst which get reset in timelib_unixtime2gmt() while other

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Derick Rethans
On Fri, 17 Jun 2011, Stas Malyshev wrote: If either of the dates use a TLA timezone (EDT, PST, GMT), rather than the long name (Europe/London, Indian/Kerguelen, America/Kentucky/Louisville), then that date is altered. Yes, this seems to be because TLA ones rely on -z and -dst which get

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Derick Rethans
On Fri, 17 Jun 2011, Derick Rethans wrote: On Fri, 17 Jun 2011, Stas Malyshev wrote: If either of the dates use a TLA timezone (EDT, PST, GMT), rather than the long name (Europe/London, Indian/Kerguelen, America/Kentucky/Louisville), then that date is altered. Yes, this seems

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Hannes Magnusson
On Fri, Jun 17, 2011 at 18:54, Derick Rethans der...@php.net wrote: On Fri, 17 Jun 2011, Derick Rethans wrote: On Fri, 17 Jun 2011, Stas Malyshev wrote: If either of the dates use a TLA timezone (EDT, PST, GMT), rather than the long name (Europe/London, Indian/Kerguelen,

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Stas Malyshev
Hi! Does it mean that all the tests Daniel added should work now? http://news.php.net/php.cvs/65174 Unfortunately, not yet. There seems to be another bug there, diff works fine now but add gives wrong result. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Stas Malyshev
Hi! Does it mean that all the tests Daniel added should work now? http://news.php.net/php.cvs/65174 Looks like ts-date conversion is broken on TLA timezones. Try: ?php $t = new DateTime('2010-11-06 18:38:28 EDT'); // prev, zt2 $ts = $t-format('U'); var_dump($ts); $t-setTimestamp($ts);

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Daniel Convissor
Hi Stas: $start = new DateTime('2010-10-04 02:18:48 EDT'); $end = new DateTime('2010-11-06 18:38:28 EDT'); $int = $start-diff($end); ... snip ... As you can see, the date in $start changed, even though it shouldn't happen. Funny you should mention that now. I ran into the same exact

Re: [PHP-DEV] date_diff broken?

2011-06-17 Thread Daniel Convissor
Hi Hannes: On Fri, Jun 17, 2011 at 07:11:53PM +0200, Hannes Magnusson wrote: Does it mean that all the tests Daniel added should work now? http://news.php.net/php.cvs/65174 Alas, no. There are other bugs in the bed. --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P

[PHP-DEV] date_diff broken?

2011-06-16 Thread Stas Malyshev
Hi! I've been looking into various tests and discovered something strange in date_diff. Example code: ?php $start = new DateTime('2010-10-04 02:18:48 EDT'); $end = new DateTime('2010-11-06 18:38:28 EDT'); $int = $start-diff($end); var_dump($start); As a result of this I'm getting this: