This repository has been archived on 2024-08-02. You can view files and clone it, but cannot push or open issues or pull requests.
orion/emlid/updater/time_sync.go

24 lines
620 B
Go
Raw Permalink Normal View History

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
}