diff options
author | Rasmus Lerdorf <rasmus@php.net> | 2007-05-25 09:12:35 +0000 |
---|---|---|
committer | Rasmus Lerdorf <rasmus@php.net> | 2007-05-25 09:12:35 +0000 |
commit | f6bffb69c55258e9e2a863c754e90c808baf6c61 (patch) | |
tree | 6cf22be33183b7a8ecac947f73f340e501b82cf1 /main | |
parent | 9998f67c9162c11a570673c4e4d0376cb545fbd5 (diff) | |
download | php-git-f6bffb69c55258e9e2a863c754e90c808baf6c61.tar.gz |
Optimize sapi_get_request_time() slightly making it use the cached time
and also checking if there is a server_context before trying to call
the request_time sapi hook.
Diffstat (limited to 'main')
-rw-r--r-- | main/SAPI.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index 0e955e4a7a..b87ba98f40 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -986,12 +986,14 @@ SAPI_API int sapi_get_target_gid(gid_t *obj TSRMLS_DC) SAPI_API time_t sapi_get_request_time(TSRMLS_D) { + if(SG(global_request_time)) return SG(global_request_time); + if (sapi_module.get_request_time) { - return sapi_module.get_request_time(TSRMLS_C); + SG(global_request_time) = (SG(server_context))?sapi_module.get_request_time(TSRMLS_C):time(0); } else { - if(!SG(global_request_time)) SG(global_request_time) = time(0); - return SG(global_request_time); + SG(global_request_time) = time(0); } + return SG(global_request_time); } /* |