24 lines
620 B
Go
24 lines
620 B
Go
package updater
|
|
|
|
import "context"
|
|
|
|
const (
|
|
eventGetTimeSyncStatus = "get time sync status"
|
|
eventTimeSyncResults = "time sync status"
|
|
)
|
|
|
|
type timeSyncStatus struct {
|
|
Status bool `json:"status"`
|
|
}
|
|
|
|
// TimeSynced returns the ReachRS module time synchronization status.
|
|
// A true response means that the module has synchronized its clock.
|
|
func (c *Client) TimeSynced(ctx context.Context) (bool, error) {
|
|
res := &timeSyncStatus{}
|
|
if err := c.ReqResp(ctx, eventGetTimeSyncStatus, nil, eventTimeSyncResults, res); err != nil {
|
|
return false, err
|
|
}
|
|
c.Logf("time sync result: %v", res.Status)
|
|
return res.Status, nil
|
|
}
|