Skip to content

Commit 5c738f5

Browse files
committed
Fixing compilation with nginx>=1.9.1
1 parent 49855a0 commit 5c738f5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/ngx_postgres_util.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ void
4545
ngx_postgres_upstream_finalize_request(ngx_http_request_t *r,
4646
ngx_http_upstream_t *u, ngx_int_t rc)
4747
{
48-
ngx_time_t *tp;
49-
5048
dd("entering");
5149

5250
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -61,10 +59,19 @@ ngx_postgres_upstream_finalize_request(ngx_http_request_t *r,
6159
u->resolved->ctx = NULL;
6260
}
6361

62+
#if defined(nginx_version) && (nginx_version >= 1009001)
63+
if (u->state && u->state->response_time) {
64+
u->state->response_time = ngx_timeofday()->msec - u->state->response_time;
65+
66+
#else
67+
68+
ngx_time_t *tp;
69+
6470
if (u->state && u->state->response_sec) {
6571
tp = ngx_timeofday();
6672
u->state->response_sec = tp->sec - u->state->response_sec;
6773
u->state->response_msec = tp->msec - u->state->response_msec;
74+
#endif
6875

6976
if (u->pipe) {
7077
u->state->response_length = u->pipe->read_length;

0 commit comments

Comments
 (0)