ticker

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2016 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Began

func Began(interval uint, now uint) time.Time

Return time when interval began for current time.

Types

type Clock

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

func NewClock

func NewClock(tickerFactory TickerFactory, nowFunc func() int64) *Clock

func (*Clock) Add

func (clock *Clock) Add(c chan time.Time, atInterval uint, sync bool)

func (*Clock) ETA

func (clock *Clock) ETA(c chan time.Time) float64

func (*Clock) Remove

func (clock *Clock) Remove(c chan time.Time)

type EvenTicker

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

func NewEvenTicker

func NewEvenTicker(atInterval uint, sleep func(time.Duration)) *EvenTicker

func (*EvenTicker) Add

func (et *EvenTicker) Add(c chan time.Time)

func (*EvenTicker) ETA

func (et *EvenTicker) ETA(nowNanosecond int64) float64

func (*EvenTicker) Remove

func (et *EvenTicker) Remove(c chan time.Time)

func (*EvenTicker) Run

func (et *EvenTicker) Run(nowNanosecond int64)

func (*EvenTicker) Stop

func (et *EvenTicker) Stop()

type Manager

type Manager interface {
	Add(c chan time.Time, atInterval uint, sync bool)
	Remove(c chan time.Time)
	ETA(c chan time.Time) float64
}

type RealTickerFactory

type RealTickerFactory struct {
}

func (*RealTickerFactory) Make

func (f *RealTickerFactory) Make(atInterval uint, sync bool) Ticker

type Ticker

type Ticker interface {
	Run(nowNanosecond int64)
	Stop()
	Add(c chan time.Time)
	Remove(c chan time.Time)
	ETA(now int64) float64
}

type TickerFactory

type TickerFactory interface {
	Make(atInterval uint, sync bool) Ticker
}

type WaitTicker

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

func NewWaitTicker

func NewWaitTicker(atInterval uint) *WaitTicker

func (*WaitTicker) Add

func (wt *WaitTicker) Add(c chan time.Time)

func (*WaitTicker) ETA

func (wt *WaitTicker) ETA(now int64) float64

func (*WaitTicker) Remove

func (wt *WaitTicker) Remove(c chan time.Time)

func (*WaitTicker) Run

func (wt *WaitTicker) Run(nowNanosecond int64)

func (*WaitTicker) Stop

func (wt *WaitTicker) Stop()

Jump to

Keyboard shortcuts

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