clock

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

A clock that provides blocking calls that wait until absolute times have occurred. The clock can be controlled programmatically or be based of real time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock interface {
	Setter
	// Wait until time t has arrived. If t is in the past it immediately returns.
	Until(t time.Time)
}

A clock interface to read time and wait until an absolute time arrives. Three implementations are available: A 'wall' clock that is based on realtime, a 'fast' clock that is always ahead and a 'set' clock that can be controlled via a setting time explicitly.

func Fast

func Fast() Clock

Get a realtime fast clock.

func New

func New(start time.Time) Clock

Get a clock that can be controlled programmatically.

func Wall

func Wall() Clock

Get a realtime wall clock.

type Setter

type Setter interface {
	// Returns the start or 'zero' time of the clock
	Zero() time.Time
	// Set the time on the clock
	Set(t time.Time)
}

Jump to

Keyboard shortcuts

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