[php-src] master: Merge branch 'PHP-8.6'
| From: | Tim Düsterhus | Date: | Wed, 30 Sep 2026 11:42:58 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141766@lists.php.net to get a copy of this message | ||
Author: Tim Düsterhus (TimWolla)
Date: 2026-09-30T13:42:40+02:00
Commit: https://github.com/php/php-src/commit/d2f40b94a97ebf30c83db3ed38c5b567ca5675bb
Raw diff: https://github.com/php/php-src/commit/d2f40b94a97ebf30c83db3ed38c5b567ca5675bb.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
zend_hrtime: use CLOCK_MONOTONIC instead of CLOCK_MONOTONIC_RAW (#23790)
Changed paths:
M Zend/zend_hrtime.c
M Zend/zend_hrtime.h
Diff:
diff --git a/Zend/zend_hrtime.c b/Zend/zend_hrtime.c
index 819f95c47662..b471ee335e1d 100644
--- a/Zend/zend_hrtime.c
+++ b/Zend/zend_hrtime.c
@@ -70,19 +70,12 @@ 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))) {
+ if (EXPECTED(0 == clock_gettime(CLOCK_MONOTONIC, &ts))) {
return;
}
// zend_error mechanism is not initialized at that point
- fprintf(stderr, "No working CLOCK_MONOTONIC* found, this should never happen\n");
+ fprintf(stderr, "No working CLOCK_MONOTONIC found, this should never happen\n");
abort();
#endif
diff --git a/Zend/zend_hrtime.h b/Zend/zend_hrtime.h
index 6d802caacfe0..f7d69d19f80b 100644
--- a/Zend/zend_hrtime.h
+++ b/Zend/zend_hrtime.h
@@ -72,6 +72,7 @@ ZEND_API extern mach_timebase_info_data_t zend_hrtime_timerlib_info;
#elif ZEND_HRTIME_PLATFORM_POSIX
+/* Not read anymore, kept for ABI compatibility */
ZEND_API extern clockid_t zend_hrtime_posix_clock_id;
#endif
@@ -94,7 +95,7 @@ static zend_always_inline zend_hrtime_t zend_hrtime(void)
return (zend_hrtime_t)mach_absolute_time() * zend_hrtime_timerlib_info.numer /
zend_hrtime_timerlib_info.denom;
#elif ZEND_HRTIME_PLATFORM_POSIX
struct timespec ts = { .tv_sec = 0, .tv_nsec = 0 };
- clock_gettime(zend_hrtime_posix_clock_id, &ts);
+ clock_gettime(CLOCK_MONOTONIC, &ts);
return ((zend_hrtime_t) ts.tv_sec * (zend_hrtime_t)ZEND_NANO_IN_SEC) + ts.tv_nsec;
#elif ZEND_HRTIME_PLATFORM_HPUX
return (zend_hrtime_t) gethrtime();