monotonic clock for macos
The otherwise recommended clock_get_time(SYSTEM_TIME) is about 40x slower than mach_absolute_time() even after minimizing overhead by retrieving the port right only once per process - see https://github.com/nigoroll/varnish-cache/tree/macos_SYSTEM_CLOCK So we revert to mach_absolute_time() which needs some scaling but otherwise does the job. It is reported to halt on iOS devices when sleeping, but even if anyone came up with the idea to sell varnish over the app store, sleeping would probably need to be avoided in the first place and otherwise the right way would probably be to adjust the offset using pre/post sleep callbacks. As MacOS should have been the last platform using the real clock fallback for VTIM_mono, we now bail out at compile-time for any platform we have overlooked.
Showing
Please register or sign in to comment