Linux kernel provides two socket options for retrieving software timestamps of incoming network packets: SO_TIMESTAMP
and SO_TIMESTAMPING
with SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_SOFTWARE
flags. The documentation describes them as follows:
SO_TIMESTAMP
Generates a timestamp for each incoming packet in (not necessarily monotonic) system time.
SO_TIMESTAMPING
Request rx timestamps when data enters the kernel. These timestamps are generated just after a device driver hands a packet to the kernel receive stack.
As far as I understood they are not the same, because the documentation says:
Note that if the SO_TIMESTAMP or SO_TIMESTAMPNS option is enabled together with SO_TIMESTAMPING using SOF_TIMESTAMPING_SOFTWARE, a false software timestamp will be generated in the recvmsg() call and passed in ts[0] when a real software timestamp is missing.
My question is, are these two timestamp types really different? If so, what's the difference?
Also I'm wondering what system time means here? Is this the same time source as clock_gettime
with CLOCK_REALTIME
provides?