Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/ngx_http_log_handler.c')
-rw-r--r--src/http/ngx_http_log_handler.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/http/ngx_http_log_handler.c b/src/http/ngx_http_log_handler.c
index 4f63d0190..057da7815 100644
--- a/src/http/ngx_http_log_handler.c
+++ b/src/http/ngx_http_log_handler.c
@@ -13,6 +13,8 @@ static u_char *ngx_http_log_pipe(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
+static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf,
+ uintptr_t data);
static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf,
uintptr_t data);
static u_char *ngx_http_log_status(ngx_http_request_t *r, u_char *buf,
@@ -106,6 +108,7 @@ ngx_http_log_op_name_t ngx_http_log_fmt_ops[] = {
{ ngx_string("pipe"), 1, ngx_http_log_pipe },
{ ngx_string("time"), sizeof("28/Sep/1970:12:00:00") - 1,
ngx_http_log_time },
+ { ngx_string("msec"), TIME_T_LEN + 4, ngx_http_log_msec },
{ ngx_string("request"), 0, ngx_http_log_request },
{ ngx_string("status"), 3, ngx_http_log_status },
{ ngx_string("length"), NGX_OFF_T_LEN, ngx_http_log_length },
@@ -225,6 +228,18 @@ static u_char *ngx_http_log_time(ngx_http_request_t *r, u_char *buf,
}
+static u_char *ngx_http_log_msec(ngx_http_request_t *r, u_char *buf,
+ uintptr_t data)
+{
+ struct timeval tv;
+
+ ngx_gettimeofday(&tv);
+
+ return buf + ngx_snprintf((char *) buf, TIME_T_LEN + 5, "%ld.%03ld",
+ tv.tv_sec, tv.tv_usec / 1000);
+}
+
+
static u_char *ngx_http_log_request(ngx_http_request_t *r, u_char *buf,
uintptr_t data)
{