StoreFBClockDataV1 will store fbclock data in shared mem, fd param should be open file descriptor of that shared mem.
(fd uintptr, d Data)
| 162 | // StoreFBClockDataV1 will store fbclock data in shared mem, |
| 163 | // fd param should be open file descriptor of that shared mem. |
| 164 | func 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. |
| 183 | func MmapShmpData(fd uintptr) (unsafe.Pointer, error) { |
no test coverage detected
searching dependent graphs…