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

Function EnableTimestamps

timestamp/timestamp_linux.go:413–435  ·  view source on GitHub ↗

EnableTimestamps enables timestamps on the socket based on requested type

(ts Timestamp, connFd int, iface *net.Interface)

Source from the content-addressed store, hash-verified

411 }
412
413 if timestamp, err := socketControlMessageSeqIDTimestamp(toob, tboob, seqID); err == nil {
414 return timestamp, attempts, nil
415 }
416 }
417 timeout := time.Since(timeStart)
418 return time.Time{}, attempts, fmt.Errorf("no TX timestamp found after %d tries (%d ms)", AttemptsTXTS, timeout.Milliseconds())
419}
420
421// ReadTXtimestamp returns HW TX timestamp
422func ReadTXtimestamp(connFd int) (time.Time, int, error) {
423 // Accessing hw timestamp
424 oob := make([]byte, ControlSizeBytes)
425 // TMP buffers
426 toob := make([]byte, ControlSizeBytes)
427
428 return ReadTXtimestampBuf(connFd, oob, toob)
429}
430
431// EnableTimestamps enables timestamps on the socket based on requested type
432func EnableTimestamps(ts Timestamp, connFd int, iface *net.Interface) error {
433 switch ts {
434 case HW:
435 if err := EnableHWTimestamps(connFd, iface); err != nil {
436 return fmt.Errorf("cannot enable hardware timestamps: %w", err)
437 }
438 case HWRX:

Callers 7

startEventListenerMethod · 0.92
listenMethod · 0.92
setupMethod · 0.92
NewUDPConnTSFunction · 0.92
startListenerMethod · 0.92
TestEnableTimestampsFunction · 0.70
TestEnableTimestampsFunction · 0.70

Calls 4

EnableSWTimestampsFunction · 0.85
EnableHWTimestampsFunction · 0.70
EnableHWTimestampsRxFunction · 0.70
EnableSWTimestampsRxFunction · 0.70

Tested by 2

TestEnableTimestampsFunction · 0.56
TestEnableTimestampsFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…