begin adding NTP client node

This commit is contained in:
soypat
2025-06-12 02:19:52 -03:00
parent 1fcdd9a7b3
commit 29ac9a3a1a
5 changed files with 81 additions and 60 deletions
+19 -3
View File
@@ -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