- 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,
}
}
-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);
}
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;
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()
/* 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);
}
/* {{{ 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;
}
/* }}} */
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;
}
}
-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;
}
}
-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 );
}