Re: 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
| From: | Pierre Joye | Date: | Sat, 06 Nov 2010 17:49:28 +0000 |
| Subject: | Re: 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 |
||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-63770@lists.php.net to get a copy of this message | ||
hi Ilia,
Please add a note to the UPGRADING file.
Thanks!
On Sat, Nov 6, 2010 at 6:14 PM, Ilia Alshanetsky <iliaa@php.net> wrote:
> iliaa Sat, 06 Nov 2010 17:14:21 +0000
>
> Revision: http://svn.php.net/viewvc?view=revision&revision=305129.
> @vOå7±^>žé~
>
> 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 /
> 1000000.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 @@
> 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 apr_time_sec(ctx->r->request_time);
> + return apr_time_as_msec(ctx->r->request_time);
> }
>
> extern zend_module_entry php_apache_module;
>
> Modified: php/php-src/trunk/sapi/apache2handler/sapi_apache2.c
> ===================================================================
> --- php/php-src/trunk/sapi/apache2handler/sapi_apache2.c 2010-11-06 16:24:58 UTC
> (rev 305128)
> +++ php/php-src/trunk/sapi/apache2handler/sapi_apache2.c 2010-11-06 17:14:21 UTC
> (rev 305129)
> @@ -335,10 +335,10 @@
> }
> }
>
> -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 apr_time_sec(ctx->r->request_time);
> + return apr_time_as_msec(ctx->r->request_time);
> }
>
> extern zend_module_entry php_apache_module;
>
> Modified: php/php-src/trunk/sapi/nsapi/nsapi.c
> ===================================================================
> --- php/php-src/trunk/sapi/nsapi/nsapi.c 2010-11-06 16:24:58 UTC (rev 305128)
> +++ php/php-src/trunk/sapi/nsapi/nsapi.c 2010-11-06 17:14:21 UTC (rev 305129)
> @@ -784,7 +784,7 @@
> }
> }
>
> -static time_t sapi_nsapi_get_request_time(TSRMLS_D)
> +static double sapi_nsapi_get_request_time(TSRMLS_D)
> {
> return REQ_TIME( ((nsapi_request_context *)SG(server_context))->rq );
> }
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org