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

Method GetTimePast

fbclock/fbclock.go:113–123  ·  view source on GitHub ↗

GetTimePast returns the [earliest, latest] PHC-domain window corresponding to a past CLOCK_REALTIME timestamp (e.g. a kernel SO_TIMESTAMPING software TX timestamp). ts must come from the same host. v2-only. If ts is older than the last GM sync, the window is error_bound only (no holdover term), so

(ts time.Time)

Source from the content-addressed store, hash-verified

111// If ts is older than the last GM sync, the window is error_bound only (no
112// holdover term), so it can look surprisingly tight for an old ts.
113func (f *FBClock) GetTimePast(ts time.Time) (*TrueTime, error) {
114 tt := &C.fbclock_truetime{}
115 errCode := C.fbclock_gettime_past(f.cFBClock, C.int64_t(ts.UnixNano()), tt)
116 if errCode != 0 {
117 return nil, fmt.Errorf("reading FBClock TrueTime past: %s", strerror(errCode))
118 }
119 return &TrueTime{
120 Earliest: time.Unix(0, int64(tt.earliest_ns)),
121 Latest: time.Unix(0, int64(tt.latest_ns)),
122 }, nil
123}
124
125// GetTimePastUTC is GetTimePast but returns UTC-adjusted values.
126func (f *FBClock) GetTimePastUTC(ts time.Time) (*TrueTime, error) {

Callers

nothing calls this directly

Calls 2

strerrorFunction · 0.85
UnixMethod · 0.80

Tested by

no test coverage detected