File tree Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Expand file tree Collapse file tree 1 file changed +3
-10
lines changed Original file line number Diff line number Diff line change 34
34
35
35
static double _timer_scale = .0 ;
36
36
37
- #elif PHP_HRTIME_PLATFORM_APPLE
38
-
39
- # include <mach/mach_time.h>
40
- # include <string.h>
41
- static mach_timebase_info_data_t _timerlib_info ;
42
-
43
37
#elif PHP_HRTIME_PLATFORM_HPUX
44
38
45
39
# include <sys/time.h>
@@ -66,9 +60,7 @@ static int _timer_init()
66
60
67
61
#elif PHP_HRTIME_PLATFORM_APPLE
68
62
69
- if (mach_timebase_info (& _timerlib_info )) {
70
- return -1 ;
71
- }
63
+ /* pass */
72
64
73
65
#elif PHP_HRTIME_PLATFORM_POSIX
74
66
@@ -115,7 +107,8 @@ static zend_always_inline php_hrtime_t _timer_current(void)
115
107
QueryPerformanceCounter (& lt );
116
108
return (php_hrtime_t )((php_hrtime_t )lt .QuadPart * _timer_scale );
117
109
#elif PHP_HRTIME_PLATFORM_APPLE
118
- return (php_hrtime_t )mach_absolute_time () * _timerlib_info .numer / _timerlib_info .denom ;
110
+ /* the value is of php_hrtime_t type already */
111
+ return clock_gettime_nsec_np (CLOCK_MONOTONIC_RAW );
119
112
#elif PHP_HRTIME_PLATFORM_POSIX
120
113
struct timespec ts = { .tv_sec = 0 , .tv_nsec = 0 };
121
114
if (0 == clock_gettime (CLOCK_MONOTONIC , & ts )) {
You can’t perform that action at this time.
0 commit comments