summaryrefslogtreecommitdiff
path: root/main/SAPI.c
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2004-08-10 17:40:00 +0000
committerRasmus Lerdorf <rasmus@php.net>2004-08-10 17:40:00 +0000
commitcad60c3760b7c858b3280ad1f1b9ea9f4187c710 (patch)
tree89469c25e0b12dd8a59e7561f9338db4da0dd842 /main/SAPI.c
parent426443cc183a1a31b4fe70caa649ecac390e245a (diff)
downloadphp-git-cad60c3760b7c858b3280ad1f1b9ea9f4187c710.tar.gz
Add SAPI hook to get the request time if provided by the web server,
otherwise call time(0) on the first call and store it so subsequent calls will get the same time. Hook support for Apache1/2 included.
Diffstat (limited to 'main/SAPI.c')
-rw-r--r--main/SAPI.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index b1e3488f06..6836a51a05 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -37,6 +37,9 @@
#ifdef ZTS
#include "TSRM.h"
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
#include "rfc1867.h"
@@ -860,7 +863,6 @@ SAPI_API struct stat *sapi_get_stat(TSRMLS_D)
}
}
-
SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC)
{
if (sapi_module.getenv) {
@@ -907,6 +909,15 @@ SAPI_API int sapi_get_target_gid(gid_t *obj TSRMLS_DC)
}
}
+SAPI_API time_t sapi_get_request_time(TSRMLS_D)
+{
+ if (sapi_module.get_request_time) {
+ return sapi_module.get_request_time(TSRMLS_C);
+ } else {
+ if(!SG(global_request_time)) SG(global_request_time) = time(0);
+ return SG(global_request_time);
+ }
+}
/*
* Local variables: