Mercurial > hg > nginx
diff src/http/ngx_http_log_handler.c @ 409:8ac40cae79f0
nginx-0.0.10-2004-08-29-07:55:41 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 29 Aug 2004 03:55:41 +0000 |
parents | 5659d773cfa8 |
children | 3c56e834be46 |
line wrap: on
line diff
--- 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_htt 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_ { 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_htt } +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) {