summaryrefslogtreecommitdiff
path: root/main/SAPI.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2010-11-06 17:14:21 +0000
committerIlia Alshanetsky <iliaa@php.net>2010-11-06 17:14:21 +0000
commitf89effd2a83de2b1d6381f9b9403a8328e0998b6 (patch)
tree346940b3c9671b154de6f45a9afc1d0dc75f5c8c /main/SAPI.c
parentd31e4e7f8e78f0ed4497de9ef4a8f3461d2ed6b3 (diff)
downloadphp-git-f89effd2a83de2b1d6381f9b9403a8328e0998b6.tar.gz
Updated _SERVER['REQUEST_TIME'] to include microsecond precision.
Diffstat (limited to 'main/SAPI.c')
-rw-r--r--main/SAPI.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 22be6c2e4d..2cc453c203 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -961,14 +961,19 @@ SAPI_API int sapi_get_target_gid(gid_t *obj TSRMLS_DC)
}
}
-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);
}