In Linux, it is possible to ask the kernel to timestamp incoming
datagrams when they are received, then to retrieve this timestamp with
an ioctl command.

Return a struct timeval with the receive timestamp of the last
packet passed to the user. This is useful for accurate round trip time
measurements. See setitimer(2) for a description of struct timeval.

As far as I understand, this timestamp is given by the CLOCK_REALTIME
clock. I would like to get the timestamp given by a different clock: the

In other words, I would like the kernel to do the equivalent of

struct timespec spec;
clock_gettime(CLOCK_MONOTONIC, &spec)

for each datagram the system receives, as soon as it is received.

How can I achieve that?

Is there a different ioctl perhaps? (I don't think so.)