在 macOS 上使用什么时钟来 return SO_TIMESTAMP 的值?
What clock is used on macOS to return the value for SO_TIMESTAMP?
由于我找不到任何文档,有谁知道当设置 SO_TIMESTAMP_MONOTONIC
时,macOS 上使用什么时钟来为辅助 header SCM_TIMESTAMP_MONOTONIC
设置 return 值?从测试来看,似乎 CLOCK_MONOTONIC_RAW
是有道理的,但也可能是 CLOCK_UPTIME_RAW
但这将是一个奇怪的选择,因为它在睡眠期间不会前进?我假设 SO_TIMESTAMP
使用 gettimeofday
的 return?
设置SO_TIMESTAMP
时,使用getmicrotime()
。
当设置SO_TIMESTAMP_MONOTONIC
时,使用mach_absolute_time()
。
来源:https://opensource.apple.com/source/xnu/xnu-6153.61.1/bsd/netinet/ip_input.c
由于我找不到任何文档,有谁知道当设置 SO_TIMESTAMP_MONOTONIC
时,macOS 上使用什么时钟来为辅助 header SCM_TIMESTAMP_MONOTONIC
设置 return 值?从测试来看,似乎 CLOCK_MONOTONIC_RAW
是有道理的,但也可能是 CLOCK_UPTIME_RAW
但这将是一个奇怪的选择,因为它在睡眠期间不会前进?我假设 SO_TIMESTAMP
使用 gettimeofday
的 return?
设置SO_TIMESTAMP
时,使用getmicrotime()
。
当设置SO_TIMESTAMP_MONOTONIC
时,使用mach_absolute_time()
。
来源:https://opensource.apple.com/source/xnu/xnu-6153.61.1/bsd/netinet/ip_input.c