ntp

package
v1.0.59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNTPGoogleConfig

func NewNTPGoogleConfig() config.NTPConfig

NewNTPGoogleConfig creates an NTPConfig object that configures NTP to use time.google.com. This is a useful default for tests, for example, to avoid loading a configuration file just to have an NTPConfig.

func NewSyncTime

func NewSyncTime(ntpConfig config.NTPConfig, syncPeriod time.Duration, customQueryFunc func(options NTPOptions) (*ntp.Response, error)) *syncTime

NewSyncTime creates a syncTime object. The customQueryFunc argument allows the caller to set a different NTP-querying callback, if desired. If set to nil, then the default queryNTP is used.

Types

type NTPOptions

type NTPOptions struct {
	Hosts        []string
	Version      int
	LocalAddress string
	Timeout      time.Duration
	Port         int
	HostIndex    int
}

NTPOptions defines configuration options for an NTP query

func NewNTPOptions

func NewNTPOptions(ntpConfig config.NTPConfig, hostIndex int) NTPOptions

NewNTPOptions creates a new NTPOptions object.

type SyncTimer

type SyncTimer interface {
	StartSync()
	ClockOffset() time.Duration
	FormattedCurrentTime() string
	CurrentTime() time.Time
	IsInterfaceNil() bool
}

SyncTimer defines an interface for time synchronization

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL