Documentation
¶
Index ¶
- Constants
- func FloatAsUint32(val float64) uint32
- func MmapShmpData(fd uintptr) (unsafe.Pointer, error)
- func StoreFBClockData(fd uintptr, d Data) error
- func Uint32AsFloat(val uint32) float64
- func Uint64ToUint32(val uint64) uint32
- type Data
- type FBClock
- type Shm
- type Stats
- type StatsCollector
- type TrueTime
Constants ¶
const PTPPath = C.FBCLOCK_PTPPATH
PTPPath is the path we set for PTP device
Variables ¶
This section is empty.
Functions ¶
func FloatAsUint32 ¶
FloatAsUint32 stores float as multiplier of 2**16. Effectively this means we can store max 65k like this.
func MmapShmpData ¶
MmapShmpData mmaps open file as fbclock shared memory. Used in tests only.
func StoreFBClockData ¶
StoreFBClockData will store fbclock data in shared mem, fd param should be open file descriptor of that shared mem.
func Uint32AsFloat ¶
Uint32AsFloat restores float that was stored as a multiplier of 2**16.
func Uint64ToUint32 ¶
Uint64ToUint32 converts uint64 to uint32, handling the overflow. If the uint64 value is more than MaxUint32, result is set to MaxUint32.
Types ¶
type Data ¶
type Data struct { IngressTimeNS int64 ErrorBoundNS uint64 HoldoverMultiplierNS float64 // float stored as multiplier of 2**16 SmearingStartS uint64 // Smearing starts before the Leap Second Event Time (midnight on June-30 or Dec-31) SmearingEndS uint64 // Smearing ends after the Leap Second Event Time (midnight on June-30 or Dec-31) UTCOffsetPreS int32 // UTC Offset before Leap Second Event UTCOffsetPostS int32 // UTC Offset after Leap Second Event }
Data is a Go equivalent of what we want to store in shared memory for fbclock to use
type FBClock ¶
type FBClock struct {
// contains filtered or unexported fields
}
FBClock wraps around fbclock C lib
func NewFBClockCustom ¶
NewFBClockCustom returns new FBClock wrapper with custom path
func (*FBClock) GetTimeUTC ¶
GetTimeUTC returns TrueTime in UTC
type Shm ¶
Shm is POSIX shared memory
func OpenFBClockSHM ¶
OpenFBClockSHM returns opened POSIX shared mem used by fbclock
func OpenFBClockShmCustom ¶
OpenFBClockShmCustom returns opened POSIX shared mem used by fbclock, with custom path
type Stats ¶
type Stats struct { Requests int64 Errors int64 WOUAvg int64 WOUMax int64 WOUlt10us int64 WOUlt100us int64 WOUlt1000us int64 WOUge1000us int64 }
Stats aggregate stats for fbclock GetTime results
type StatsCollector ¶
type StatsCollector struct {
// contains filtered or unexported fields
}
StatsCollector collects stats based on GetTime results
func (*StatsCollector) Update ¶
func (s *StatsCollector) Update(tt *TrueTime, err error)
Update processes result of GetTime call and updates Stats