summaryrefslogtreecommitdiff
path: root/sapi/apache2handler/sapi_apache2.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 /sapi/apache2handler/sapi_apache2.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 'sapi/apache2handler/sapi_apache2.c')
-rw-r--r--sapi/apache2handler/sapi_apache2.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c
index e7e9571044..78d3aa4133 100644
--- a/sapi/apache2handler/sapi_apache2.c
+++ b/sapi/apache2handler/sapi_apache2.c
@@ -277,6 +277,13 @@ static void php_apache_sapi_log_message_ex(char *msg, request_rec *r)
}
}
+static time_t php_apache_sapi_get_request_time(void) {
+ php_struct *ctx = SG(server_context);
+ TSRMLS_FETCH();
+
+ return ctx->r->request_time;
+}
+
extern zend_module_entry php_apache_module;
static int php_apache2_startup(sapi_module_struct *sapi_module)
@@ -313,6 +320,7 @@ static sapi_module_struct apache2_sapi_module = {
php_apache_sapi_register_variables,
php_apache_sapi_log_message, /* Log message */
+ php_apache_sapi_get_request_time, /* Request Time */
STANDARD_SAPI_MODULE_PROPERTIES
};