From:             
Operating system: 64 bit Centos
PHP version:      5.2.14
Package:          Date/time related
Bug Type:         Bug
Bug description:DateTime->setTimezone() very slow far future dates

Description:
------------
DateTime->setTimezone() is very slow on dates in the far future (or
history), and the time needed isnt monotonic for greater dates.



ie. setTimezone() on a DateTime(PHP_INT_MAX) /* 64 bit max */ takes 0.05
seconds, but takes 250 whole seconds for PHP_INT_MAX/2 .



Using the $timezone parameter of the DateTime constructor is always fast
though.

Test script:
---------------
        $start = microtime(1);

        $date = new DateTime('@'.(PHP_INT_MAX));

//      $date = new DateTime('@'.(int)(PHP_INT_MAX / 2));

        $date->setTimezone(new DateTimeZone('Europe/Amsterdam'));



        echo microtime(1) - $start;

Expected result:
----------------
A faster change of the timezone; performance equal to using the constructor
parameter


-- 
Edit bug report at http://bugs.php.net/bug.php?id=53294&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=53294&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=53294&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=53294&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=53294&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=53294&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=53294&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=53294&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=53294&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=53294&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=53294&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=53294&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=53294&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=53294&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=53294&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=53294&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=53294&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=53294&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=53294&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=53294&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=53294&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=53294&r=mysqlcfg

Reply via email to