Unnecessary overhead in getdate()

From: Date: Thu, 29 Mar 2018 09:51:20 +0000
Subject: Unnecessary overhead in getdate()
Groups: php.internals 
Request: Send a blank email to internals+get-102007@lists.php.net to get a copy of this message
Hello, Just like [i]date(), getdate() without the $timestamp argument uses the current timestamp. The code for [i]date() (https://github.com/php/php-src/blob/master/ext/date/php_date.c#L1276) only makes a system call to time(NULL) when the $timestamp argument is missing. In contrast getdate() (https://github.com/php/php-src/blob/master/ext/date/php_date.c#L1828) always performs a system call to time(NULL) even if $timestamp is supplied by the user. The code for getdate() should mimic what is done for date() to avoid unnecessary system call overhead, hence only call time(NULL) when !ZEND_NUM_ARGS(). Can someone please make the appropriate change? Please apologize, but I simply review code and do not have a proper C development setup that allows me to supply patches or create pull requests. Thanks, Ben -- Benjamin Coutu http://www.zeyos.com

« previous php.internals (#102007) next »