EnableSWTimestamps enables SW timestamps (TX and RX) on the socket
(connFd int)
| 159 | flags := unix.SOF_TIMESTAMPING_TX_SOFTWARE | |
| 160 | unix.SOF_TIMESTAMPING_RX_SOFTWARE | |
| 161 | unix.SOF_TIMESTAMPING_SOFTWARE | |
| 162 | unix.SOF_TIMESTAMPING_OPT_TSONLY // Makes the kernel return the timestamp as a cmsg alongside an empty packet, as opposed to alongside the original packet. |
| 163 | // Allow reading of SW timestamps via socket |
| 164 | if err := unix.SetsockoptInt(connFd, unix.SOL_SOCKET, timestamping, flags); err != nil { |
| 165 | return err |
| 166 | } |
| 167 | |
| 168 | return unix.SetsockoptInt(connFd, unix.SOL_SOCKET, unix.SO_SELECT_ERR_QUEUE, 1) |
| 169 | } |
| 170 | |
| 171 | // EnableHWTimestamps enables HW timestamps (TX and RX) on the socket |
| 172 | func EnableHWTimestamps(connFd int, iface *net.Interface) error { |
| 173 | rxFilter, err := ioctlHWTimestampCaps(connFd, iface.Name) |
| 174 | if err != nil { |
| 175 | return err |
no outgoing calls
searching dependent graphs…