Skip to content

Commit 21e7398

Browse files
committed
Fixing compilation with nginx>=1.9.1
1 parent 49855a0 commit 21e7398

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/ngx_postgres_util.c

+13
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,12 @@ void
4545
ngx_postgres_upstream_finalize_request(ngx_http_request_t *r,
4646
ngx_http_upstream_t *u, ngx_int_t rc)
4747
{
48+
#if defined(nginx_version) && (nginx_version >= 1009001)
49+
4850
ngx_time_t *tp;
4951

52+
#endif
53+
5054
dd("entering");
5155

5256
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -61,11 +65,20 @@ ngx_postgres_upstream_finalize_request(ngx_http_request_t *r,
6165
u->resolved->ctx = NULL;
6266
}
6367

68+
#if defined(nginx_version) && (nginx_version >= 1009001)
69+
70+
if (u->state && u->state->response_time) {
71+
u->state->response_time = ngx_timeofday()->msec - u->state->response_time;
72+
73+
#else
74+
6475
if (u->state && u->state->response_sec) {
6576
tp = ngx_timeofday();
6677
u->state->response_sec = tp->sec - u->state->response_sec;
6778
u->state->response_msec = tp->msec - u->state->response_msec;
6879

80+
#endif
81+
6982
if (u->pipe) {
7083
u->state->response_length = u->pipe->read_length;
7184
}

0 commit comments

Comments
 (0)