Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What clock is used on macOS to return the value for SO_TIMESTAMP?

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?

like image 892
Rudolfs Bundulis Avatar asked Nov 30 '25 03:11

Rudolfs Bundulis


1 Answers

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

like image 54
user2962393 Avatar answered Dec 02 '25 15:12

user2962393