diff options
author | Igor Sysoev <igor@sysoev.ru> | 2004-08-29 03:55:41 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2004-08-29 03:55:41 +0000 |
commit | a7c4a2a6f898a0b3add9f36e56288734414a12f7 (patch) | |
tree | bd7fa2cd0e26cd974df02b2788db000402d7d366 /src/http/ngx_http_log_handler.c | |
parent | 967fd637e08b6df4f635014fb572296372c89254 (diff) | |
download | nginx-a7c4a2a6f898a0b3add9f36e56288734414a12f7.tar.gz nginx-a7c4a2a6f898a0b3add9f36e56288734414a12f7.zip |
nginx-0.0.10-2004-08-29-07:55:41 import
Diffstat (limited to 'src/http/ngx_http_log_handler.c')
-rw-r--r-- | src/http/ngx_http_log_handler.c | 15 |
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) { |