forked from thrasher-corp/gocryptotrader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ntp_manager_types.go
49 lines (44 loc) · 1.44 KB
/
ntp_manager_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package engine
import (
"errors"
"time"
)
const (
defaultNTPCheckInterval = time.Second * 30
defaultRetryLimit = 3
// NTPManagerName is an exported subsystem name
NTPManagerName = "ntp_timekeeper"
)
var (
errNilConfigValues = errors.New("nil allowed time differences received")
errNTPManagerDisabled = errors.New("NTP manager disabled")
)
// ntpManager starts the NTP manager
type ntpManager struct {
started int32
shutdown chan struct{}
level int64
allowedDifference time.Duration
allowedNegativeDifference time.Duration
pools []string
checkInterval time.Duration
retryLimit int
loggingEnabled bool
}
type ntpPacket struct {
Settings uint8 // leap yr indicator, ver number, and mode
Stratum uint8 // stratum of local clock
Poll int8 // poll exponent
Precision int8 // precision exponent
RootDelay uint32 // root delay
RootDispersion uint32 // root dispersion
ReferenceID uint32 // reference id
RefTimeSec uint32 // reference timestamp sec
RefTimeFrac uint32 // reference timestamp fractional
OrigTimeSec uint32 // origin time secs
OrigTimeFrac uint32 // origin time fractional
RxTimeSec uint32 // receive time secs
RxTimeFrac uint32 // receive time frac
TxTimeSec uint32 // transmit time secs
TxTimeFrac uint32 // transmit time frac
}