Skip to content

Commit 7950a25

Browse files
committed
feature: fixed compilation errors with nginx 1.9.1+. thanks Vadim A. Misbakh-Soloviov for the original patch in FRiCKLE#38.
1 parent 04e33d1 commit 7950a25

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/ngx_postgres_util.c

+7
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ 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)
4849
ngx_time_t *tp;
50+
#endif
4951

5052
dd("entering");
5153

@@ -61,10 +63,15 @@ ngx_postgres_upstream_finalize_request(ngx_http_request_t *r,
6163
u->resolved->ctx = NULL;
6264
}
6365

66+
#if defined(nginx_version) && (nginx_version >= 1009001)
67+
if (u->state && u->state->response_time) {
68+
u->state->response_time = ngx_current_msec - u->state->response_time;
69+
#else
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)