ticker

package module
v0.0.0-...-8b48701 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2014 License: BSD-3-Clause Imports: 2 Imported by: 0

README

ticker

This package implements a ticker that can be stopped and re-started.

Install with go get github.com/tjgq/ticker.

Browse the package documentation at http://godoc.org/github.com/tjgq/ticker.

Documentation

Overview

Package ticker implements a ticker that can be stopped and re-started.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ticker

type Ticker struct {
	C chan time.Time // The channel on which ticks are delivered.
	// contains filtered or unexported fields
}

A Ticker holds a channel that delivers ticks at intervals.

func New

func New(d time.Duration) *Ticker

New returns a new ticker that ticks every d seconds. It adjusts the intervals or drops ticks to make up for slow receivers. The ticker is initially in the stopped state.

func (*Ticker) Start

func (t *Ticker) Start()

Start (re-)starts the ticker. Ticks will be delivered on the ticker's channel until Stop is called.

func (*Ticker) Stop

func (t *Ticker) Stop()

Stop stops the ticker. No ticks will be delivered on the ticker's channel after Stop returns and before Start is called again.

func (*Ticker) Stopped

func (t *Ticker) Stopped() bool

Stopped returns whether the ticker is stopped.

Jump to

Keyboard shortcuts

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