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

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

Reply via email to