timesource

package
v0.131.7 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: MPL-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// DefaultMaxAllowedFailures defines how many failures will be tolerated.
	DefaultMaxAllowedFailures = 1

	// FastNTPSyncPeriod period between ntp synchronizations before the first
	// successful connection.
	FastNTPSyncPeriod = 2 * time.Minute

	// SlowNTPSyncPeriod period between ntp synchronizations after the first
	// successful connection.
	SlowNTPSyncPeriod = 1 * time.Hour

	// DefaultRPCTimeout defines write deadline for single ntp server request.
	DefaultRPCTimeout = 2 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type NTPTimeSource

type NTPTimeSource struct {
	// contains filtered or unexported fields
}

NTPTimeSource provides source of time that tries to be resistant to time skews. It does so by periodically querying time offset from ntp servers.

func Default

func Default() *NTPTimeSource

Default initializes time source with default config values.

func (*NTPTimeSource) APIs

func (s *NTPTimeSource) APIs() []rpc.API

APIs used to be conformant with service interface

func (*NTPTimeSource) Now

func (s *NTPTimeSource) Now() time.Time

Now returns time adjusted by latest known offset

func (*NTPTimeSource) Protocols

func (s *NTPTimeSource) Protocols() []p2p.Protocol

Protocols used to conformant with service interface

func (*NTPTimeSource) Start

func (s *NTPTimeSource) Start() error

Start runs a goroutine that updates local offset every updatePeriod.

func (*NTPTimeSource) StartService added in v0.39.7

func (s *NTPTimeSource) StartService() error

func (*NTPTimeSource) Stop

func (s *NTPTimeSource) Stop() error

Stop goroutine that updates time source.

Jump to

Keyboard shortcuts

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