This commit is contained in:
Andrew Clayton 2026-05-13 03:58:32 +00:00 committed by GitHub
commit 5fefa5fac9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 11 additions and 33 deletions

View file

@ -838,13 +838,9 @@ static u_char *
ngx_http_log_request_time(ngx_http_request_t *r, u_char *buf,
ngx_http_log_op_t *op)
{
ngx_time_t *tp;
ngx_msec_int_t ms;
ngx_msec_int_t ms;
tp = ngx_timeofday();
ms = (ngx_msec_int_t)
((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
ms = (ngx_msec_int_t) (ngx_current_msec - r->start_time);
ms = ngx_max(ms, 0);
return ngx_sprintf(buf, "%T.%03M", (time_t) ms / 1000, ms % 1000);

View file

@ -2391,7 +2391,6 @@ ngx_http_subrequest(ngx_http_request_t *r,
ngx_str_t *uri, ngx_str_t *args, ngx_http_request_t **psr,
ngx_http_post_subrequest_t *ps, ngx_uint_t flags)
{
ngx_time_t *tp;
ngx_connection_t *c;
ngx_http_request_t *sr;
ngx_http_core_srv_conf_t *cscf;
@ -2545,9 +2544,7 @@ ngx_http_subrequest(ngx_http_request_t *r,
sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1;
sr->subrequests = r->subrequests - 1;
tp = ngx_timeofday();
sr->start_sec = tp->sec;
sr->start_msec = tp->msec;
sr->start_time = ngx_current_msec;
r->main->count++;

View file

@ -570,7 +570,6 @@ static ngx_http_request_t *
ngx_http_alloc_request(ngx_connection_t *c)
{
ngx_pool_t *pool;
ngx_time_t *tp;
ngx_http_request_t *r;
ngx_http_connection_t *hc;
ngx_http_core_srv_conf_t *cscf;
@ -645,9 +644,7 @@ ngx_http_alloc_request(ngx_connection_t *c)
r->main = r;
r->count = 1;
tp = ngx_timeofday();
r->start_sec = tp->sec;
r->start_msec = tp->msec;
r->start_time = ngx_current_msec;
r->method = NGX_HTTP_UNKNOWN;
r->http_version = NGX_HTTP_VERSION_10;

View file

@ -412,8 +412,7 @@ struct ngx_http_request_s {
ngx_http_request_body_t *request_body;
time_t lingering_time;
time_t start_sec;
ngx_msec_t start_msec;
ngx_msec_t start_time;
ngx_uint_t method;
ngx_uint_t http_version;

View file

@ -2270,7 +2270,6 @@ ngx_http_variable_request_time(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
u_char *p;
ngx_time_t *tp;
ngx_msec_int_t ms;
p = ngx_pnalloc(r->pool, NGX_TIME_T_LEN + 4);
@ -2278,10 +2277,7 @@ ngx_http_variable_request_time(ngx_http_request_t *r,
return NGX_ERROR;
}
tp = ngx_timeofday();
ms = (ngx_msec_int_t)
((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
ms = (ngx_msec_int_t) (ngx_current_msec - r->start_time);
ms = ngx_max(ms, 0);
v->len = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000) - p;

View file

@ -268,7 +268,8 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
r->limit_rate_after_set = 1;
}
limit = (off_t) r->limit_rate * (ngx_time() - r->start_sec + 1)
limit = (off_t) r->limit_rate
* (ngx_current_msec / 1000 - r->start_time / 1000 + 1)
- (c->sent - r->limit_rate_after);
if (limit <= 0) {

View file

@ -264,8 +264,7 @@ struct ngx_stream_session_s {
ngx_connection_t *connection;
off_t received;
time_t start_sec;
ngx_msec_t start_msec;
ngx_msec_t start_time;
ngx_log_handler_pt log_handler;

View file

@ -23,7 +23,6 @@ ngx_stream_init_connection(ngx_connection_t *c)
u_char text[NGX_SOCKADDR_STRLEN];
size_t len;
ngx_uint_t i;
ngx_time_t *tp;
ngx_event_t *rev;
struct sockaddr *sa;
ngx_stream_port_t *port;
@ -173,9 +172,7 @@ ngx_stream_init_connection(ngx_connection_t *c)
return;
}
tp = ngx_timeofday();
s->start_sec = tp->sec;
s->start_msec = tp->msec;
s->start_time = ngx_current_msec;
rev = c->read;
rev->handler = ngx_stream_session_handler;

View file

@ -776,7 +776,6 @@ ngx_stream_variable_session_time(ngx_stream_session_t *s,
ngx_stream_variable_value_t *v, uintptr_t data)
{
u_char *p;
ngx_time_t *tp;
ngx_msec_int_t ms;
p = ngx_pnalloc(s->connection->pool, NGX_TIME_T_LEN + 4);
@ -784,10 +783,7 @@ ngx_stream_variable_session_time(ngx_stream_session_t *s,
return NGX_ERROR;
}
tp = ngx_timeofday();
ms = (ngx_msec_int_t)
((tp->sec - s->start_sec) * 1000 + (tp->msec - s->start_msec));
ms = (ngx_msec_int_t) (ngx_current_msec - s->start_time);
ms = ngx_max(ms, 0);
v->len = ngx_sprintf(p, "%T.%03M", (time_t) ms / 1000, ms % 1000) - p;