Welcome! Log In Create A New Profile

Advanced

[nginx] Win32: $request_time fixed.

Maxim Dounin
September 04, 2013 01:16PM
details: http://hg.nginx.org/nginx/rev/7094d6da2806
branches:
changeset: 5361:7094d6da2806
user: Maxim Dounin <mdounin@mdounin.ru>
date: Wed Sep 04 20:48:30 2013 +0400
description:
Win32: $request_time fixed.

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.

diffstat:

src/http/modules/ngx_http_log_module.c | 2 +-
src/http/ngx_http_variables.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff --git a/src/http/modules/ngx_http_log_module.c b/src/http/modules/ngx_http_log_module.c
--- a/src/http/modules/ngx_http_log_module.c
+++ b/src/http/modules/ngx_http_log_module.c
@@ -780,7 +780,7 @@ ngx_http_log_request_time(ngx_http_reque
((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);
}


diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c
--- a/src/http/ngx_http_variables.c
+++ b/src/http/ngx_http_variables.c
@@ -1992,7 +1992,7 @@ ngx_http_variable_request_time(ngx_http_
((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;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Win32: $request_time fixed.

Maxim Dounin 776 September 04, 2013 01:16PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 255
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready