@@ -1370,22 +1370,21 @@ static int single_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t size) {
1370
1370
1371
1371
static int my_poll (php_socket_t fd , int events , int timeout ) {
1372
1372
int n ;
1373
- zend_hrtime_t timeout_hr = (zend_hrtime_t ) timeout * 1000000 ;
1373
+ uint64_t timeout_ns = (uint64_t ) timeout * 1000000 ;
1374
1374
1375
1375
while (true) {
1376
- zend_hrtime_t start_ns = zend_hrtime ();
1377
- n = php_pollfd_for_ms (fd , events , (int ) (timeout_hr / 1000000 ));
1376
+ uint64_t start_ns = zend_monotime_fallback ();
1377
+ n = php_pollfd_for_ms (fd , events , (int ) (timeout_ns / 1000000 ));
1378
1378
1379
1379
if (n == -1 && php_socket_errno () == EINTR ) {
1380
- zend_hrtime_t delta_ns = zend_hrtime () - start_ns ;
1381
- /* delta_ns == 0 is only possible with a platform that does not support a high-res timer. */
1382
- if (delta_ns > timeout_hr || UNEXPECTED (delta_ns == 0 )) {
1380
+ uint64_t delta_ns = zend_monotime_fallback () - start_ns ;
1381
+ if (delta_ns > timeout_ns ) {
1383
1382
#ifndef PHP_WIN32
1384
1383
errno = ETIMEDOUT ;
1385
1384
#endif
1386
1385
break ;
1387
1386
}
1388
- timeout_hr -= delta_ns ;
1387
+ timeout_ns -= delta_ns ;
1389
1388
} else {
1390
1389
break ;
1391
1390
}
0 commit comments