clock

package
v0.15.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0 Imports: 1 Imported by: 59

Documentation

Overview

Package clock implements facilities for working with wall clock time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitUntil

func WaitUntil(fn ConditionFn, timeout time.Duration) bool

WaitUntil returns true if the condition specified evaluated to true before the timeout, false otherwise.

Types

type ConditionFn

type ConditionFn func() bool

ConditionFn specifies a predicate to check.

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 NowFn

type NowFn func() time.Time

NowFn is the function supplied to determine "now".

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.

func NewOptions

func NewOptions() Options

NewOptions creates new clock options.

Jump to

Keyboard shortcuts

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