# HG changeset patch # User Igor Sysoev # Date 1195136796 0 # Node ID 02a22cd5282aff55fb19029776e470ab8af64ed8 # Parent 7d125a707158a1308b31131004c3fa6d118c922c 64-bit time_t compatibility diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c --- a/src/core/ngx_times.c +++ b/src/core/ngx_times.c @@ -205,16 +205,16 @@ ngx_gmtime(time_t t, ngx_tm_t *tp) { ngx_int_t sec, min, hour, mday, mon, year, wday, yday, days; - days = t / 86400; + days = (ngx_int_t) (t / 86400); /* Jaunary 1, 1970 was Thursday */ wday = (4 + days) % 7; t %= 86400; - hour = t / 3600; + hour = (ngx_int_t) (t / 3600); t %= 3600; - min = t / 60; - sec = t % 60; + min = (ngx_int_t) (t / 60); + sec = (ngx_int_t) (t % 60); /* the algorithm based on Gauss's formula */ 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 @@ -400,7 +400,8 @@ ngx_http_log_request_time(ngx_http_reque tp = ngx_timeofday(); - ms = (tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec); + ms = (ngx_msec_int_t) + ((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec)); ms = (ms >= 0) ? ms : 0; return ngx_sprintf(buf, "%T.%03M", ms / 1000, ms % 1000); diff --git a/src/http/modules/ngx_http_userid_filter_module.c b/src/http/modules/ngx_http_userid_filter_module.c --- a/src/http/modules/ngx_http_userid_filter_module.c +++ b/src/http/modules/ngx_http_userid_filter_module.c @@ -318,7 +318,7 @@ ngx_http_userid_set_uid(ngx_http_request } else { ctx->uid_set[0] = conf->service; } - ctx->uid_set[1] = ngx_time(); + ctx->uid_set[1] = (uint32_t) ngx_time(); ctx->uid_set[2] = ngx_pid; ctx->uid_set[3] = sequencer_v1; sequencer_v1 += 0x100; @@ -345,7 +345,7 @@ ngx_http_userid_set_uid(ngx_http_request ctx->uid_set[0] = htonl(conf->service); } - ctx->uid_set[1] = htonl(ngx_time()); + ctx->uid_set[1] = htonl((uint32_t) ngx_time()); ctx->uid_set[2] = htonl(ngx_pid); ctx->uid_set[3] = htonl(sequencer_v2); sequencer_v2 += 0x100; diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -2341,7 +2341,7 @@ ngx_http_lingering_close_handler(ngx_eve return; } - timer = r->lingering_time - ngx_time(); + timer = (ngx_msec_t) (r->lingering_time - ngx_time()); if (timer <= 0) { ngx_http_close_request(r, 0); return; diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c --- a/src/http/ngx_http_request_body.c +++ b/src/http/ngx_http_request_body.c @@ -493,7 +493,7 @@ ngx_http_read_discarded_request_body_han } if (r->lingering_time) { - timer = r->lingering_time - ngx_time(); + timer = (ngx_msec_t) (r->lingering_time - ngx_time()); if (timer <= 0) { r->discard_body = 0; diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2873,7 +2873,8 @@ ngx_http_upstream_response_time_variable for ( ;; ) { if (state[i].status) { - ms = state[i].response_sec * 1000 + state[i].response_msec; + ms = (ngx_msec_int_t) + (state[i].response_sec * 1000 + state[i].response_msec); ms = (ms >= 0) ? ms : 0; p = ngx_sprintf(p, "%d.%03d", ms / 1000, ms % 1000); diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -718,7 +718,7 @@ ngx_mail_auth_http_process_headers(ngx_m return; } - ngx_add_timer(s->connection->read, timer * 1000); + ngx_add_timer(s->connection->read, (ngx_msec_t) (timer * 1000)); s->connection->read->handler = ngx_mail_auth_sleep_handler; @@ -735,7 +735,7 @@ ngx_mail_auth_http_process_headers(ngx_m return; } - ngx_add_timer(s->connection->read, timer * 1000); + ngx_add_timer(s->connection->read, (ngx_msec_t) (timer * 1000)); s->connection->read->handler = ngx_mail_auth_sleep_handler;