Documentation
¶
Index ¶
- Constants
- func PTP4LWorker(client *pmc.Client, reqCh <-chan GrandmasterUpdateRequest, lg *slog.Logger)
- func RefClockWorker(rc RefClock, sampCh <-chan RefClockSample, lg *slog.Logger)
- type Grandmaster
- type GrandmasterProps
- type GrandmasterUpdateRequest
- type LoggingSockRefClock
- type Monitor
- func (mon *Monitor) Close()
- func (mon *Monitor) Pause()
- func (mon *Monitor) ReopenLog()
- func (mon *Monitor) Sample(ref ptime.Time, local ptime.ClockTime, delayed bool)
- func (mon *Monitor) SetLeapSecond(leapSecond ptime.LeapSecond)
- func (mon *Monitor) SysSample(ref ptime.Time, sys time.Time)
- func (mon *Monitor) Tick(now time.Time)
- type MonitorConfig
- type MultiSampler
- type ProxyRefClock
- type RefClock
- type RefClockSample
- type SampleData
- type SampleKind
- type Sampler
- type Servo
- type SockRefClock
- type SyncState
Constants ¶
const ClockLogExtension = ".log"
Variables ¶
This section is empty.
Functions ¶
func PTP4LWorker ¶
func PTP4LWorker(client *pmc.Client, reqCh <-chan GrandmasterUpdateRequest, lg *slog.Logger)
PTP4LWorker processes GrandmasterUpdateRequests and sends them to ptp4l. It should be run in a goroutine. It returns when reqCh is closed. The updating goroutine must wait for a response to each request before sending another request.
func RefClockWorker ¶
func RefClockWorker(rc RefClock, sampCh <-chan RefClockSample, lg *slog.Logger)
Types ¶
type Grandmaster ¶
type Grandmaster struct {
// contains filtered or unexported fields
}
func NewGrandmaster ¶
func NewGrandmaster() (*Grandmaster, <-chan GrandmasterUpdateRequest)
func (*Grandmaster) Close ¶
func (gm *Grandmaster) Close()
func (*Grandmaster) SetClockAccuracy ¶
func (gm *Grandmaster) SetClockAccuracy(acc time.Duration) error
func (*Grandmaster) SetClockSync ¶
func (gm *Grandmaster) SetClockSync(syncState SyncState)
func (*Grandmaster) Update ¶
func (gm *Grandmaster) Update(state SyncState, leap ptime.LeapSecondState)
type GrandmasterProps ¶
type GrandmasterProps struct {
ptime.LeapSecondState
ClockClass uint8
ClockAccuracy pmc.ClockAccuracy
}
func (*GrandmasterProps) SetClock ¶
func (props *GrandmasterProps) SetClock(acc pmc.ClockAccuracy)
func (*GrandmasterProps) Settings ¶
func (props *GrandmasterProps) Settings() pmc.GrandmasterSettings
type GrandmasterUpdateRequest ¶
type GrandmasterUpdateRequest struct {
// contains filtered or unexported fields
}
type LoggingSockRefClock ¶
type LoggingSockRefClock struct {
// contains filtered or unexported fields
}
LoggingSockRefClock does error handling for a refclock that sends to a socket that may not exist. The error handling consists of logging changes in when the socket exists.
func NewLoggingSockRefClock ¶
func NewLoggingSockRefClock(lg *slog.Logger, sock SockRefClock) *LoggingSockRefClock
func (*LoggingSockRefClock) Close ¶
func (rc *LoggingSockRefClock) Close() error
func (*LoggingSockRefClock) Sample ¶
func (rc *LoggingSockRefClock) Sample(sys time.Time, ref ptime.Time, ls ptime.LeapSecond) error
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
func NewMonitor ¶
func (*Monitor) SetLeapSecond ¶
func (mon *Monitor) SetLeapSecond(leapSecond ptime.LeapSecond)
type MonitorConfig ¶
type MonitorConfig struct {
LeapSecond ptime.LeapSecond
LogInterval int
ClockLogPath string
ClockAccuracy time.Duration
RefClock *ProxyRefClock
Grandmaster *Grandmaster
Sampler Sampler // never nil, uses DefaultObserver when no observability needed
}
type MultiSampler ¶
type MultiSampler struct {
// contains filtered or unexported fields
}
MultiSampler fans out Sample calls to multiple samplers
func NewMultiSampler ¶
func NewMultiSampler(samplers ...Sampler) *MultiSampler
NewMultiSampler creates a new MultiSampler that fans out to multiple samplers
func (*MultiSampler) Sample ¶
func (m *MultiSampler) Sample(data SampleData)
Sample implements Sampler by calling Sample on all samplers
type ProxyRefClock ¶
type ProxyRefClock struct {
// contains filtered or unexported fields
}
func NewProxyRefClock ¶
func NewProxyRefClock() (*ProxyRefClock, <-chan RefClockSample)
func (*ProxyRefClock) Close ¶
func (rc *ProxyRefClock) Close()
func (*ProxyRefClock) Sample ¶
func (rc *ProxyRefClock) Sample(sys time.Time, ref ptime.Time, ls ptime.LeapSecond) error
type RefClockSample ¶
type SampleData ¶
type SampleData struct {
Kind SampleKind // Determines validity of other fields
Ref ptime.Time // GPS reference time (different from system time)
Offset time.Duration // PHC/GPS offset (valid for SampleOK and SampleOutlier, 0 for SampleMissing)
Freq float64 // Current frequency adjustment in PPB (always valid)
FreqDelta float64 // Change in frequency adjustment in PPB (valid for SampleOK, 0 for SampleOutlier)
SyncState SyncState // Current synchronization state (always valid)
Era ptime.Era // For clock step tracking and logging (always valid)
}
SampleData contains all information about a synchronization sample
type SampleKind ¶
type SampleKind int
SampleKind determines the validity and type of a synchronization sample
const ( SampleMissing SampleKind = iota // Missing sample (PPS signal not received) SampleOK // Valid sample within acceptable limits SampleOutlier // Sample that is an outlier but still measured )
type Sampler ¶
type Sampler interface {
// Sample reports a clock synchronization sample of any kind
Sample(data SampleData)
}
Sampler handles clock synchronization samples of all types