--- a/src/http/ngx_http_accounting_module.c 2019-05-28 08:48:45.000000000 +0200 +++ b/src/http/ngx_http_accounting_module.c 2026-10-17 21:54:22.654979083 +0200 @@ -265,7 +265,11 @@ ngx_http_accounting_request_handler(ngx_ metrics->nr_status[ngx_status_bsearch(status, ngx_http_statuses, ngx_http_statuses_len)] += 1; +#if defined(freenginx) + ms = (ngx_msec_int_t)(ngx_current_msec - r->start_time); +#else ms = (ngx_msec_int_t)((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec)); +#endif ms = ngx_max(ms, 0); metrics->total_latency_ms += ms; --- a/src/stream/ngx_stream_accounting_module.c 2019-05-28 08:48:45.000000000 +0200 +++ b/src/stream/ngx_stream_accounting_module.c 2026-10-17 21:54:22.655115722 +0200 @@ -260,7 +260,11 @@ ngx_stream_accounting_session_handler(ng metrics->nr_status[ngx_status_bsearch(status, ngx_stream_statuses, ngx_stream_statuses_len)] += 1; +#if defined(freenginx) + ms = (ngx_msec_int_t)(ngx_current_msec - s->start_time); +#else ms = (ngx_msec_int_t)((tp->sec - s->start_sec) * 1000 + (tp->msec - s->start_msec)); +#endif ms = ngx_max(ms, 0); metrics->total_latency_ms += ms;