File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -215,10 +215,9 @@ CF_EXPORT void OSMemoryBarrier();
215
215
216
216
CF_INLINE uint64_t mach_absolute_time () {
217
217
#if TARGET_OS_WIN32
218
- LARGE_INTEGER count ;
219
- QueryPerformanceCounter (& count );
220
- // mach_absolute_time is unsigned, but this function returns a signed value.
221
- return (uint64_t )count .QuadPart ;
218
+ ULONGLONG ullTime ;
219
+ QueryUnbiasedInterruptTimePrecise (& ullTime );
220
+ return ullTime ;
222
221
#else
223
222
struct timespec ts ;
224
223
clock_gettime (CLOCK_MONOTONIC , & ts );
Original file line number Diff line number Diff line change @@ -171,11 +171,10 @@ CF_PRIVATE void __CFDateInitialize(void) {
171
171
__CFTSRRate = (1.0E9 / (double )info .numer ) * (double )info .denom ;
172
172
__CF1_TSRRate = 1.0 / __CFTSRRate ;
173
173
#elif TARGET_OS_WIN32
174
- LARGE_INTEGER freq ;
175
- if (!QueryPerformanceFrequency (& freq )) {
176
- HALT ;
177
- }
178
- __CFTSRRate = (double )freq .QuadPart ;
174
+ // We are using QueryUnbiasedInterruptTimePrecise as time source.
175
+ // It returns result in system time units of 100 nanoseconds.
176
+ // To get seconds we need to divide the value by 1e7 (10000000).
177
+ __CFTSRRate = 1.0e7 ;
179
178
__CF1_TSRRate = 1.0 / __CFTSRRate ;
180
179
#elif TARGET_OS_LINUX || TARGET_OS_BSD
181
180
struct timespec res ;
You can’t perform that action at this time.
0 commit comments