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

Method Time

phc/device.go:48–54  ·  view source on GitHub ↗

Time returns time from the PTP device using the clock_gettime syscall

()

Source from the content-addressed store, hash-verified

46
47// Time returns time from the PTP device using the clock_gettime syscall
48func (dev *Device) Time() (time.Time, error) {
49 var ts unix.Timespec
50 if err := unix.ClockGettime(dev.ClockID(), &ts); err != nil {
51 return time.Time{}, fmt.Errorf("failed clock_gettime: %w", err)
52 }
53 return time.Unix(ts.Unix()), nil
54}
55
56// ReadSysoffExtended reads the precise time from the PHC along with SYS time to measure the call delay.
57// The nsamples parameter is set to ExtendedNumProbes.

Callers

nothing calls this directly

Calls 3

ClockIDMethod · 0.95
ClockGettimeFunction · 0.92
UnixMethod · 0.80

Tested by

no test coverage detected