Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS main/SAPI.c main/SAPI.h main/php_variables.c sapi/apache/mod_php5.c sapi/apache2filter/sapi_apache2.c sapi/apache2handler/sapi_apache2.c sapi/nsapi/nsapi.c
Done, thanks for the reminder. On Sat, Nov 6, 2010 at 6:49 PM, Pierre Joye pierre@gmail.com wrote: hi Ilia, Please add a note to the UPGRADING file. Thanks! On Sat, Nov 6, 2010 at 6:14 PM, Ilia Alshanetsky il...@php.net wrote: iliaa Sat, 06 Nov 2010 17:14:21 + Revision: http://svn.php.net/viewvc?view=revisionrevision=305129 Log: Updated _SERVER['REQUEST_TIME'] to include microsecond precision. Changed paths: U php/php-src/trunk/NEWS U php/php-src/trunk/main/SAPI.c U php/php-src/trunk/main/SAPI.h U php/php-src/trunk/main/php_variables.c U php/php-src/trunk/sapi/apache/mod_php5.c U php/php-src/trunk/sapi/apache2filter/sapi_apache2.c U php/php-src/trunk/sapi/apache2handler/sapi_apache2.c U php/php-src/trunk/sapi/nsapi/nsapi.c Modified: php/php-src/trunk/NEWS === --- php/php-src/trunk/NEWS 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/NEWS 2010-11-06 17:14:21 UTC (rev 305129) @@ -4,6 +4,7 @@ - Upgraded bundled sqlite to version 3.7.3. (Ilia) - Upgraded bundled PCRE to version 8.10. (Ilia) +- Updated _SERVER['REQUEST_TIME'] to include microsecond precision. (Ilia) - Added apache compatible functions (apache_child_terminate, getallheaders, apache_request_headers, apache_response_headers) to FastCGI SAPI (Dmitry) - Added caches to eliminate repeatable run-time bindings of functions, classes, Modified: php/php-src/trunk/main/SAPI.c === --- php/php-src/trunk/main/SAPI.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/SAPI.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -961,14 +961,19 @@ } } -SAPI_API time_t sapi_get_request_time(TSRMLS_D) +SAPI_API double sapi_get_request_time(TSRMLS_D) { if(SG(global_request_time)) return SG(global_request_time); if (sapi_module.get_request_time SG(server_context)) { SG(global_request_time) = sapi_module.get_request_time(TSRMLS_C); } else { - SG(global_request_time) = time(0); + struct timeval tp = {0}; + if (!gettimeofday(tp, NULL)) { + SG(global_request_time) = (double)(tp.tv_sec + tp.tv_usec / 100.00); + } else { + SG(global_request_time) = (double)time(0); + } } return SG(global_request_time); } Modified: php/php-src/trunk/main/SAPI.h === --- php/php-src/trunk/main/SAPI.h 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/SAPI.h 2010-11-06 17:14:21 UTC (rev 305129) @@ -129,7 +129,7 @@ long post_max_size; int options; zend_bool sapi_started; - time_t global_request_time; + double global_request_time; HashTable known_post_content_types; } sapi_globals_struct; @@ -208,7 +208,7 @@ SAPI_API int sapi_get_target_uid(uid_t * TSRMLS_DC); SAPI_API int sapi_get_target_gid(gid_t * TSRMLS_DC); -SAPI_API time_t sapi_get_request_time(TSRMLS_D); +SAPI_API double sapi_get_request_time(TSRMLS_D); SAPI_API void sapi_terminate_process(TSRMLS_D); END_EXTERN_C() Modified: php/php-src/trunk/main/php_variables.c === --- php/php-src/trunk/main/php_variables.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/php_variables.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -590,8 +590,8 @@ /* store request init time */ { zval new_entry; - Z_TYPE(new_entry) = IS_LONG; - Z_LVAL(new_entry) = sapi_get_request_time(TSRMLS_C); + Z_TYPE(new_entry) = IS_DOUBLE; + Z_DVAL(new_entry) = sapi_get_request_time(TSRMLS_C); php_register_variable_ex(REQUEST_TIME, new_entry, array_ptr TSRMLS_CC); } Modified: php/php-src/trunk/sapi/apache/mod_php5.c === --- php/php-src/trunk/sapi/apache/mod_php5.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/sapi/apache/mod_php5.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -438,9 +438,9 @@ /* {{{ php_apache_get_request_time */ -static time_t php_apache_get_request_time(TSRMLS_D) +static double php_apache_get_request_time(TSRMLS_D) { - return ((request_rec *)SG(server_context))-request_time; + return (double) ((request_rec *)SG(server_context))-request_time; } /* }}} */ Modified: php/php-src/trunk/sapi/apache2filter/sapi_apache2.c === --- php/php-src/trunk/sapi/apache2filter/sapi_apache2.c 2010-11-06 16:24:58 UTC (rev 305128) +++
[PHP-CVS] svn: /php/php-src/trunk/ NEWS main/SAPI.c main/SAPI.h main/php_variables.c sapi/apache/mod_php5.c sapi/apache2filter/sapi_apache2.c sapi/apache2handler/sapi_apache2.c sapi/nsapi/nsapi.c
iliaaSat, 06 Nov 2010 17:14:21 + Revision: http://svn.php.net/viewvc?view=revisionrevision=305129 Log: Updated _SERVER['REQUEST_TIME'] to include microsecond precision. Changed paths: U php/php-src/trunk/NEWS U php/php-src/trunk/main/SAPI.c U php/php-src/trunk/main/SAPI.h U php/php-src/trunk/main/php_variables.c U php/php-src/trunk/sapi/apache/mod_php5.c U php/php-src/trunk/sapi/apache2filter/sapi_apache2.c U php/php-src/trunk/sapi/apache2handler/sapi_apache2.c U php/php-src/trunk/sapi/nsapi/nsapi.c Modified: php/php-src/trunk/NEWS === --- php/php-src/trunk/NEWS 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/NEWS 2010-11-06 17:14:21 UTC (rev 305129) @@ -4,6 +4,7 @@ - Upgraded bundled sqlite to version 3.7.3. (Ilia) - Upgraded bundled PCRE to version 8.10. (Ilia) +- Updated _SERVER['REQUEST_TIME'] to include microsecond precision. (Ilia) - Added apache compatible functions (apache_child_terminate, getallheaders, apache_request_headers, apache_response_headers) to FastCGI SAPI (Dmitry) - Added caches to eliminate repeatable run-time bindings of functions, classes, Modified: php/php-src/trunk/main/SAPI.c === --- php/php-src/trunk/main/SAPI.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/SAPI.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -961,14 +961,19 @@ } } -SAPI_API time_t sapi_get_request_time(TSRMLS_D) +SAPI_API double sapi_get_request_time(TSRMLS_D) { if(SG(global_request_time)) return SG(global_request_time); if (sapi_module.get_request_time SG(server_context)) { SG(global_request_time) = sapi_module.get_request_time(TSRMLS_C); } else { - SG(global_request_time) = time(0); + struct timeval tp = {0}; + if (!gettimeofday(tp, NULL)) { + SG(global_request_time) = (double)(tp.tv_sec + tp.tv_usec / 100.00); + } else { + SG(global_request_time) = (double)time(0); + } } return SG(global_request_time); } Modified: php/php-src/trunk/main/SAPI.h === --- php/php-src/trunk/main/SAPI.h 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/SAPI.h 2010-11-06 17:14:21 UTC (rev 305129) @@ -129,7 +129,7 @@ long post_max_size; int options; zend_bool sapi_started; - time_t global_request_time; + double global_request_time; HashTable known_post_content_types; } sapi_globals_struct; @@ -208,7 +208,7 @@ SAPI_API int sapi_get_target_uid(uid_t * TSRMLS_DC); SAPI_API int sapi_get_target_gid(gid_t * TSRMLS_DC); -SAPI_API time_t sapi_get_request_time(TSRMLS_D); +SAPI_API double sapi_get_request_time(TSRMLS_D); SAPI_API void sapi_terminate_process(TSRMLS_D); END_EXTERN_C() Modified: php/php-src/trunk/main/php_variables.c === --- php/php-src/trunk/main/php_variables.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/php_variables.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -590,8 +590,8 @@ /* store request init time */ { zval new_entry; - Z_TYPE(new_entry) = IS_LONG; - Z_LVAL(new_entry) = sapi_get_request_time(TSRMLS_C); + Z_TYPE(new_entry) = IS_DOUBLE; + Z_DVAL(new_entry) = sapi_get_request_time(TSRMLS_C); php_register_variable_ex(REQUEST_TIME, new_entry, array_ptr TSRMLS_CC); } Modified: php/php-src/trunk/sapi/apache/mod_php5.c === --- php/php-src/trunk/sapi/apache/mod_php5.c2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/sapi/apache/mod_php5.c2010-11-06 17:14:21 UTC (rev 305129) @@ -438,9 +438,9 @@ /* {{{ php_apache_get_request_time */ -static time_t php_apache_get_request_time(TSRMLS_D) +static double php_apache_get_request_time(TSRMLS_D) { - return ((request_rec *)SG(server_context))-request_time; + return (double) ((request_rec *)SG(server_context))-request_time; } /* }}} */ Modified: php/php-src/trunk/sapi/apache2filter/sapi_apache2.c === --- php/php-src/trunk/sapi/apache2filter/sapi_apache2.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/sapi/apache2filter/sapi_apache2.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -308,10 +308,10 @@ return OK; } -static time_t php_apache_sapi_get_request_time(TSRMLS_D) +static double php_apache_sapi_get_request_time(TSRMLS_D) { php_struct *ctx = SG(server_context); - return
Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS main/SAPI.c main/SAPI.h main/php_variables.c sapi/apache/mod_php5.c sapi/apache2filter/sapi_apache2.c sapi/apache2handler/sapi_apache2.c sapi/nsapi/nsapi.c
hi Ilia, Please add a note to the UPGRADING file. Thanks! On Sat, Nov 6, 2010 at 6:14 PM, Ilia Alshanetsky il...@php.net wrote: iliaa Sat, 06 Nov 2010 17:14:21 + Revision: http://svn.php.net/viewvc?view=revisionrevision=305129 Log: Updated _SERVER['REQUEST_TIME'] to include microsecond precision. Changed paths: U php/php-src/trunk/NEWS U php/php-src/trunk/main/SAPI.c U php/php-src/trunk/main/SAPI.h U php/php-src/trunk/main/php_variables.c U php/php-src/trunk/sapi/apache/mod_php5.c U php/php-src/trunk/sapi/apache2filter/sapi_apache2.c U php/php-src/trunk/sapi/apache2handler/sapi_apache2.c U php/php-src/trunk/sapi/nsapi/nsapi.c Modified: php/php-src/trunk/NEWS === --- php/php-src/trunk/NEWS 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/NEWS 2010-11-06 17:14:21 UTC (rev 305129) @@ -4,6 +4,7 @@ - Upgraded bundled sqlite to version 3.7.3. (Ilia) - Upgraded bundled PCRE to version 8.10. (Ilia) +- Updated _SERVER['REQUEST_TIME'] to include microsecond precision. (Ilia) - Added apache compatible functions (apache_child_terminate, getallheaders, apache_request_headers, apache_response_headers) to FastCGI SAPI (Dmitry) - Added caches to eliminate repeatable run-time bindings of functions, classes, Modified: php/php-src/trunk/main/SAPI.c === --- php/php-src/trunk/main/SAPI.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/SAPI.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -961,14 +961,19 @@ } } -SAPI_API time_t sapi_get_request_time(TSRMLS_D) +SAPI_API double sapi_get_request_time(TSRMLS_D) { if(SG(global_request_time)) return SG(global_request_time); if (sapi_module.get_request_time SG(server_context)) { SG(global_request_time) = sapi_module.get_request_time(TSRMLS_C); } else { - SG(global_request_time) = time(0); + struct timeval tp = {0}; + if (!gettimeofday(tp, NULL)) { + SG(global_request_time) = (double)(tp.tv_sec + tp.tv_usec / 100.00); + } else { + SG(global_request_time) = (double)time(0); + } } return SG(global_request_time); } Modified: php/php-src/trunk/main/SAPI.h === --- php/php-src/trunk/main/SAPI.h 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/SAPI.h 2010-11-06 17:14:21 UTC (rev 305129) @@ -129,7 +129,7 @@ long post_max_size; int options; zend_bool sapi_started; - time_t global_request_time; + double global_request_time; HashTable known_post_content_types; } sapi_globals_struct; @@ -208,7 +208,7 @@ SAPI_API int sapi_get_target_uid(uid_t * TSRMLS_DC); SAPI_API int sapi_get_target_gid(gid_t * TSRMLS_DC); -SAPI_API time_t sapi_get_request_time(TSRMLS_D); +SAPI_API double sapi_get_request_time(TSRMLS_D); SAPI_API void sapi_terminate_process(TSRMLS_D); END_EXTERN_C() Modified: php/php-src/trunk/main/php_variables.c === --- php/php-src/trunk/main/php_variables.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/main/php_variables.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -590,8 +590,8 @@ /* store request init time */ { zval new_entry; - Z_TYPE(new_entry) = IS_LONG; - Z_LVAL(new_entry) = sapi_get_request_time(TSRMLS_C); + Z_TYPE(new_entry) = IS_DOUBLE; + Z_DVAL(new_entry) = sapi_get_request_time(TSRMLS_C); php_register_variable_ex(REQUEST_TIME, new_entry, array_ptr TSRMLS_CC); } Modified: php/php-src/trunk/sapi/apache/mod_php5.c === --- php/php-src/trunk/sapi/apache/mod_php5.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/sapi/apache/mod_php5.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -438,9 +438,9 @@ /* {{{ php_apache_get_request_time */ -static time_t php_apache_get_request_time(TSRMLS_D) +static double php_apache_get_request_time(TSRMLS_D) { - return ((request_rec *)SG(server_context))-request_time; + return (double) ((request_rec *)SG(server_context))-request_time; } /* }}} */ Modified: php/php-src/trunk/sapi/apache2filter/sapi_apache2.c === --- php/php-src/trunk/sapi/apache2filter/sapi_apache2.c 2010-11-06 16:24:58 UTC (rev 305128) +++ php/php-src/trunk/sapi/apache2filter/sapi_apache2.c 2010-11-06 17:14:21 UTC (rev 305129) @@ -308,10 +308,10 @@