Please refer to Open Source Software Block Diagram as the following.

Timestamp Processing in Open Source
•A shared time stamp structure – struct skb_shared_hwtstamps.
struct skb_shared_hwtstamps {
ktime_t hwtstamp;
ktime_t syststamp; /* hwtstamp transformed to system time base */
};
•Time stamps for received packets was stored in the skb. Get a pointer to the shared time stamp structure by calling skb_hwtstamps(). Then set the time stamps in the structure skb_shared_hwtstamps.
•For outgoing packets, skb_hwtstamp_tx() clones the original skb and adds the timestamp to structure skb_shared_hwtstamps. The cloned skb with the send timestamp attached is looped back to the socket's error queue.
•PTPd get the RX timestamp by calling recvmsg() and the TX timestamp by calling recvmsg(flags=MSG_ERRQUEUE).