Documentation
¶
Overview ¶
Package clock implements facilities for working with wall clock time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct {
// MaxPositiveSkew is the maximum positive clock skew
// with regard to a reference clock.
MaxPositiveSkew time.Duration `yaml:"maxPositiveSkew"`
// MaxNegativeSkew is the maximum negative clock skew
// with regard to a reference clock.
MaxNegativeSkew time.Duration `yaml:"maxNegativeSkew"`
}
Configuration configures clock options.
func (Configuration) NewOptions ¶
func (c Configuration) NewOptions() Options
NewOptions creates a new set of options.
type OffsetClock ¶ added in v1.2.0
type OffsetClock struct {
// contains filtered or unexported fields
}
OffsetClock represents offset clock which returns current time from the initial seed time value.
func NewOffsetClock ¶ added in v1.2.0
func NewOffsetClock(offsetTime time.Time, nowFn NowFn) OffsetClock
NewOffsetClock returns new offset clock.
func NewOffsetClockFromTimeDelta ¶ added in v1.2.0
func NewOffsetClockFromTimeDelta(timeDelta time.Duration, nowFn NowFn) OffsetClock
NewOffsetClockFromTimeDelta returns new offset clock that has time shifted by timeDelta duration.
func (OffsetClock) Now ¶ added in v1.2.0
func (c OffsetClock) Now() time.Time
Now returns current time with time offset taken into account.
type Options ¶
type Options interface {
// SetNowFn sets the NowFn.
SetNowFn(value NowFn) Options
// NowFn returns the NowFn.
NowFn() NowFn
// SetMaxPositiveSkew sets the maximum positive clock skew
// with regard to a reference clock.
SetMaxPositiveSkew(value time.Duration) Options
// MaxPositiveSkew returns the maximum positive clock skew
// with regard to a reference clock.
MaxPositiveSkew() time.Duration
// SetMaxNegativeSkew sets the maximum negative clock skew
// with regard to a reference clock.
SetMaxNegativeSkew(value time.Duration) Options
// MaxNegativeSkew returns the maximum negative clock skew
// with regard to a reference clock.
MaxNegativeSkew() time.Duration
}
Options represents the options for the clock.
Click to show internal directories.
Click to hide internal directories.