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

Function StoreFBClockDataV1

fbclock/shmem.go:164–180  ·  view source on GitHub ↗

StoreFBClockDataV1 will store fbclock data in shared mem, fd param should be open file descriptor of that shared mem.

(fd uintptr, d Data)

Source from the content-addressed store, hash-verified

162// StoreFBClockDataV1 will store fbclock data in shared mem,
163// fd param should be open file descriptor of that shared mem.
164func StoreFBClockDataV1(fd uintptr, d Data) error {
165 cData := &C.fbclock_clockdata{
166 ingress_time_ns: C.int64_t(d.IngressTimeNS),
167 error_bound_ns: C.uint32_t(Uint64ToUint32(d.ErrorBoundNS)),
168 holdover_multiplier_ns: C.uint32_t(FloatAsUint32(d.HoldoverMultiplierNS)),
169 clock_smearing_start_s: C.uint64_t(d.SmearingStartS),
170 clock_smearing_end_s: C.uint64_t(d.SmearingEndS),
171 utc_offset_pre_s: C.int32_t(d.UTCOffsetPreS),
172 utc_offset_post_s: C.int32_t(d.UTCOffsetPostS),
173 }
174 // fbclock_clockdata_store_data comes from fbclock.c
175 res := C.fbclock_clockdata_store_data(C.uint(fd), cData)
176 if res != 0 {
177 return fmt.Errorf("failed to store data: %s", strerror(res))
178 }
179 return nil
180}
181
182// MmapShmpData mmaps open file as fbclock shared memory. Used in tests only.
183func MmapShmpData(fd uintptr) (unsafe.Pointer, error) {

Callers 1

doWorkMethod · 0.92

Calls 3

Uint64ToUint32Function · 0.85
FloatAsUint32Function · 0.85
strerrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…