clock

package
v0.0.0-...-6f48322 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2015 License: LGPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WallClock wallClock

WallClock exposes wall-clock time via the Clock interface.

Functions

func Alarm

func Alarm(c Clock, t time.Time) <-chan time.Time

Alarm returns a channel that will have the time sent on it at some point after the supplied time occurs.

This is short for c.After(t.Sub(c.Now())).

Types

type Clock

type Clock interface {

	// Now returns the current clock time.
	Now() time.Time

	// After waits for the duration to elapse and then sends the
	// current time on the returned channel.
	After(time.Duration) <-chan time.Time
}

Clock provides an interface for dealing with clocks.

Jump to

Keyboard shortcuts

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