Mercurial > hg > nginx-vendor-1-0
diff src/http/modules/ngx_http_log_module.c @ 298:30862655219e NGINX_0_5_19
nginx 0.5.19
*) Change: now the $request_time variable has millisecond precision.
*) Change: the method $r->rflush of ngx_http_perl_module was renamed to
the $r->flush.
*) Feature: the $upstream_addr variable.
*) Feature: the "proxy_headers_hash_max_size" and
"proxy_headers_hash_bucket_size" directives.
Thanks to Volodymyr Kostyrko.
*) Bugfix: the files more than 2G could not be transferred using
sendfile and limit_rate on 64-bit platforms.
*) Bugfix: the files more than 2G could not be transferred using
sendfile on 64-bit Linux.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 24 Apr 2007 00:00:00 +0400 |
parents | 2ceaee987f37 |
children | a6d84efa5106 |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_log_module.c +++ b/src/http/modules/ngx_http_log_module.c @@ -170,7 +170,8 @@ static ngx_http_log_var_t ngx_http_log_ { ngx_string("time_local"), sizeof("28/Sep/1970:12:00:00 +0600") - 1, ngx_http_log_time }, { ngx_string("msec"), NGX_TIME_T_LEN + 4, ngx_http_log_msec }, - { ngx_string("request_time"), NGX_TIME_T_LEN, ngx_http_log_request_time }, + { ngx_string("request_time"), NGX_TIME_T_LEN + 4, + ngx_http_log_request_time }, { ngx_string("status"), 3, ngx_http_log_status }, { ngx_string("bytes_sent"), NGX_OFF_T_LEN, ngx_http_log_bytes_sent }, { ngx_string("body_bytes_sent"), NGX_OFF_T_LEN, @@ -394,11 +395,15 @@ static u_char * ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf, ngx_http_log_op_t *op) { - time_t elapsed; + ngx_time_t *tp; + ngx_msec_int_t ms; + + tp = ngx_timeofday(); - elapsed = ngx_time() - r->start_time; + ms = (tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec); + ms = (ms >= 0) ? ms : 0; - return ngx_sprintf(buf, "%T", elapsed); + return ngx_sprintf(buf, "%T.%03M", ms / 1000, ms % 1000); }