]> git.kaiwu.me - nginx.git/commitdiff
Removed CLOCK_MONOTONIC_COARSE support.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 21 Oct 2021 15:38:38 +0000 (18:38 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 21 Oct 2021 15:38:38 +0000 (18:38 +0300)
While clock_gettime(CLOCK_MONOTONIC_COARSE) is faster than
clock_gettime(CLOCK_MONOTONIC), the latter is fast enough on Linux for
practical usage, and the difference is negligible compared to other costs
at each event loop iteration.  On the other hand, CLOCK_MONOTONIC_COARSE
causes various issues with typical CONFIG_HZ=250, notably very inaccurate
limit_rate handling in some edge cases (ticket #1678) and negative difference
between $request_time and $upstream_response_time (ticket #1965).

src/core/ngx_times.c

index 7964b008f72ec835397725a7b9e64f269bd1e9ef..16788c98cb2ed2a63ebfbdeea199b0d54d63435c 100644 (file)
@@ -200,10 +200,6 @@ ngx_monotonic_time(time_t sec, ngx_uint_t msec)
 
 #if defined(CLOCK_MONOTONIC_FAST)
     clock_gettime(CLOCK_MONOTONIC_FAST, &ts);
-
-#elif defined(CLOCK_MONOTONIC_COARSE)
-    clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
-
 #else
     clock_gettime(CLOCK_MONOTONIC, &ts);
 #endif