From 52da76a04e309618da85197846b91ea27d36055d Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Thu, 23 Jul 2015 22:18:37 +0200 Subject: [PATCH] Use CLOCK_MONOTONIC_COARSE in httpinput.cpp; we do not need precise timing here. --- httpinput.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/httpinput.cpp b/httpinput.cpp index 807abac..a2ca2c2 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -274,7 +274,7 @@ void HTTPInput::do_work() // TODO: Make the timeout persist across restarts. if (state == SENDING_REQUEST || state == RECEIVING_HEADER || state == RECEIVING_DATA) { - int err = clock_gettime(CLOCK_MONOTONIC, &last_activity); + int err = clock_gettime(CLOCK_MONOTONIC_COARSE, &last_activity); assert(err != -1); } @@ -284,7 +284,7 @@ void HTTPInput::do_work() static const int timeout_secs = 30; timespec now; - int err = clock_gettime(CLOCK_MONOTONIC, &now); + int err = clock_gettime(CLOCK_MONOTONIC_COARSE, &now); assert(err != -1); timespec elapsed = clock_diff(last_activity, now); @@ -303,7 +303,7 @@ void HTTPInput::do_work() bool activity = wait_for_activity(sock, (state == SENDING_REQUEST) ? POLLOUT : POLLIN, &timeout); if (activity) { - err = clock_gettime(CLOCK_MONOTONIC, &last_activity); + err = clock_gettime(CLOCK_MONOTONIC_COARSE, &last_activity); assert(err != -1); } else { // OK. Most likely, should_stop was set, or we have timed out. @@ -345,7 +345,7 @@ void HTTPInput::do_work() MutexLock lock(&stats_mutex); stats.connect_time = time(NULL); - clock_gettime(CLOCK_MONOTONIC, &last_activity); + clock_gettime(CLOCK_MONOTONIC_COARSE, &last_activity); } break; case SENDING_REQUEST: { -- 2.39.2