From 95003a4f60549322c88893d776236df824e4f922 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 20 Sep 2026 16:40:30 +0200 Subject: [PATCH] zend_hrtime: use CLOCK_MONOTONIC instead of CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC_RAW is not disciplined by NTP, so it ticks with the raw frequency error of the underlying oscillator, which is 4% under WSL2 and makes hrtime() disagree with microtime() by that much. The slew that GH-19221 wanted to avoid is bounded to 500ppm by the kernel and is what makes CLOCK_MONOTONIC track elapsed real time. --- Zend/zend_hrtime.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Zend/zend_hrtime.c b/Zend/zend_hrtime.c index 819f95c47662..b616bbc521ef 100644 --- a/Zend/zend_hrtime.c +++ b/Zend/zend_hrtime.c @@ -70,13 +70,6 @@ void zend_startup_hrtime(void) struct timespec ts; -#ifdef CLOCK_MONOTONIC_RAW - if (EXPECTED(0 == clock_gettime(CLOCK_MONOTONIC_RAW, &ts))) { - zend_hrtime_posix_clock_id = CLOCK_MONOTONIC_RAW; - return; - } -#endif - if (EXPECTED(0 == clock_gettime(zend_hrtime_posix_clock_id, &ts))) { return; }