Documentation
¶
Overview ¶
Package clock contains a wrapper around CLOCK_ADJTIME syscall.
It allows interactions with supported clocks, such as system realtime clock or PHC.
Supported methods include getting the frequency, adjusting the frequency, stepping the clock, etc.
Index ¶
- Constants
- func AdjFreqPPB(clockid int32, freqPPB float64) (state int, err error)
- func FrequencyPPB(clockid int32) (freqPPB float64, state int, err error)
- func MaxFreqPPB(clockid int32) (freqPPB float64, state int, err error)
- func SetSync(clockid int32) error
- func Step(clockid int32, step time.Duration) (state int, err error)
Constants ¶
const ( // time offset AdjOffset uint32 = 0x0001 // frequency offset AdjFrequency uint32 = 0x0002 // maximum time error AdjMaxError uint32 = 0x0004 // estimated time error AdjEstError uint32 = 0x0008 // clock status AdjStatus uint32 = 0x0010 // pll time constant AdjTimeConst uint32 = 0x0020 // set TAI offset AdjTAI uint32 = 0x0080 // add 'time' to current time AdjSetOffset uint32 = 0x0100 // select microsecond resolution AdjMicro uint32 = 0x1000 // select nanosecond resolution AdjNano uint32 = 0x2000 // tick value AdjTick uint32 = 0x4000 )
clock_adjtime modes from usr/include/linux/timex.h
const PPBToTimexPPM = 65.536
PPBToTimexPPM is what we use to conver PPB to PPM. man clock_adjtime(2): In struct timex, freq, ppsfreq, and stabil are ppm (parts per million) with a 16-bit fractional part. To covert value where 2^16=65536 is 1 ppm to ppb or back, we need this multiplier
Variables ¶
This section is empty.
Functions ¶
func AdjFreqPPB ¶
AdjFreqPPB adjusts clock frequency in PPB
func FrequencyPPB ¶
FrequencyPPB reads device frequency in PPB
func MaxFreqPPB ¶
MaxFreqPPB returns maximum frequency adjustment supported by the clock
Types ¶
This section is empty.