MCPcopy Create free account
hub / github.com/facebook/time / EnableSWTimestamps

Function EnableSWTimestamps

timestamp/timestamp_linux.go:161–172  ·  view source on GitHub ↗

EnableSWTimestamps enables SW timestamps (TX and RX) on the socket

(connFd int)

Source from the content-addressed store, hash-verified

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
172func EnableHWTimestamps(connFd int, iface *net.Interface) error {
173 rxFilter, err := ioctlHWTimestampCaps(connFd, iface.Name)
174 if err != nil {
175 return err

Callers 4

EnableTimestampsFunction · 0.85
Test_ReadTXtimestampFunction · 0.85
TestEnableSWTimestampsFunction · 0.85

Calls

no outgoing calls

Tested by 3

Test_ReadTXtimestampFunction · 0.68
TestEnableSWTimestampsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…