ReadFBClockDataV1 will read Data from mmaped fbclock shared memory. Used in tests only
(shmp unsafe.Pointer)
| 200 | |
| 201 | // ReadFBClockDataV1 will read Data from mmaped fbclock shared memory. Used in tests only |
| 202 | func ReadFBClockDataV1(shmp unsafe.Pointer) (*Data, error) { |
| 203 | cData := &C.fbclock_clockdata{} |
| 204 | shmpData := (*C.fbclock_shmdata)(shmp) |
| 205 | // fbclock_clockdata_load_data comes from fbclock.c |
| 206 | res := C.fbclock_clockdata_load_data(shmpData, cData) |
| 207 | if res != 0 { |
| 208 | return nil, fmt.Errorf("failed to store data: %s", strerror(res)) |
| 209 | } |
| 210 | return &Data{ |
| 211 | IngressTimeNS: int64(cData.ingress_time_ns), |
| 212 | ErrorBoundNS: uint64(cData.error_bound_ns), |
| 213 | HoldoverMultiplierNS: Uint32AsFloat(uint32(cData.holdover_multiplier_ns)), |
| 214 | }, nil |
| 215 | } |
| 216 | |
| 217 | // MmapShmpDataV2 mmaps open file as fbclock shared memory. Used in tests only. |
| 218 | func MmapShmpDataV2(fd uintptr) (unsafe.Pointer, error) { |
searching dependent graphs…