]> git.kaiwu.me - nginx.git/commitdiff
Win32: $request_time fixed.
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 4 Sep 2013 16:48:30 +0000 (20:48 +0400)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 4 Sep 2013 16:48:30 +0000 (20:48 +0400)
On win32, time_t is 64 bits wide by default, and passing an ngx_msec_int_t
argument for %T format specifier doesn't work.  This doesn't manifest itself
on other platforms as time_t and ngx_msec_int_t are usually of the same size.

src/http/modules/ngx_http_log_module.c
src/http/ngx_http_variables.c

index aa6a3fceee95de123ebde336946c84c5380a9f5c..7eb29b38a0abb1e997d6355800d32ebe0e44c048 100644 (file)
@@ -780,7 +780,7 @@ ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf,
              ((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
     ms = ngx_max(ms, 0);
 
-    return ngx_sprintf(buf, "%T.%03M", ms / 1000, ms % 1000);
+    return ngx_sprintf(buf, "%T.%03M", (time_t) ms / 1000, ms % 1000);
 }
 
 
index 6f1e0344dda9370fa59d7577b342295d0892bca9..7a7d15c1e0d3a50261cea581cc61650879225291 100644 (file)
@@ -1988,7 +1988,7 @@ ngx_http_variable_request_time(ngx_http_request_t *r,
              ((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
     ms = ngx_max(ms, 0);
 
-    v->len = ngx_sprintf(p, "%T.%03M", ms / 1000, ms % 1000) - p;
+    v->len = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000) - p;
     v->valid = 1;
     v->no_cacheable = 0;
     v->not_found = 0;