Since I could not find any documentation, does anyone know what clock is used on macOS to return value for ancillary header SCM_TIMESTAMP_MONOTONIC when SO_TIMESTAMP_MONOTONIC is set? From tests, seems that it could be CLOCK_MONOTONIC_RAW which would make sense, but it could also be CLOCK_UPTIME_RAW but that would be a weird choice since it does not advance during sleep? I assume that for SO_TIMESTAMP the return of gettimeofday is used?
When SO_TIMESTAMP is set, getmicrotime() is used.
When SO_TIMESTAMP_MONOTONIC is set, mach_absolute_time() is used.
Source: https://opensource.apple.com/source/xnu/xnu-6153.61.1/bsd/netinet/ip_input.c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With