From 8b6844c747ce533fba9ab26f3a6eff96e9b318c4 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Tue, 5 Dec 2006 20:30:05 +0000 Subject: [PATCH] fix msec overflow --- src/http/ngx_http_upstream.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index da1c9adeb..03b590f5b 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -502,7 +502,7 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) if (u->state && u->state->response_time) { tp = ngx_timeofday(); - ms = tp->sec * 1000 + tp->msec - u->state->response_time; + ms = (ngx_msec_t) tp->sec * 1000 + tp->msec - u->state->response_time; u->state->response_time = (ms >= 0) ? ms : 0; } @@ -516,7 +516,7 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) ngx_memzero(u->state, sizeof(ngx_http_upstream_state_t)); tp = ngx_timeofday(); - u->state->response_time = tp->sec * 1000 + tp->msec; + u->state->response_time = (ngx_msec_t) tp->sec * 1000 + tp->msec; rc = ngx_event_connect_peer(&u->peer); @@ -2053,7 +2053,7 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r, if (u->state->response_time) { tp = ngx_timeofday(); - ms = tp->sec * 1000 + tp->msec - u->state->response_time; + ms = (ngx_msec_t) tp->sec * 1000 + tp->msec - u->state->response_time; u->state->response_time = (ms >= 0) ? ms : 0; }