mirror of
https://github.com/soypat/lneto.git
synced 2026-09-11 09:09:30 +00:00
begin adding NTP client node
This commit is contained in:
+19
-3
@@ -27,9 +27,10 @@ func NewClient(now func() time.Time) *Client {
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
start time.Time
|
||||
_now func() time.Time
|
||||
t [4]Timestamp
|
||||
connID uint64
|
||||
start time.Time
|
||||
_now func() time.Time
|
||||
t [4]Timestamp
|
||||
// org Timestamp
|
||||
// rec Timestamp
|
||||
xmt Timestamp
|
||||
@@ -38,6 +39,21 @@ type Client struct {
|
||||
_sysprec int8
|
||||
}
|
||||
|
||||
func (c *Client) Reset(now func() time.Time) {
|
||||
if c._sysprec == 0 {
|
||||
c._sysprec = sysprecRecalcNeeded
|
||||
}
|
||||
*c = Client{
|
||||
connID: c.connID + 1,
|
||||
_now: now,
|
||||
_sysprec: c._sysprec,
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) ConnectionID() *uint64 {
|
||||
return &c.connID
|
||||
}
|
||||
|
||||
func (c *Client) Send(payload []byte) (int, error) {
|
||||
if c.isDone() {
|
||||
return 0, io.EOF
|
||||
|
||||
Reference in New Issue
Block a user