File: ticker.go

package info (click to toggle)
golang-github-siddontang-go 0.0~git20170517.0.cb568a3-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 492 kB
  • sloc: makefile: 3
file content (30 lines) | stat: -rw-r--r-- 459 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package time2

import (
	"time"
)

type Ticker struct {
	C <-chan time.Time
	r *timer
}

func NewTicker(d time.Duration) *Ticker {
	return defaultWheel.NewTicker(d)
}

func TickFunc(d time.Duration, f func()) *Ticker {
	return defaultWheel.TickFunc(d, f)
}

func Tick(d time.Duration) <-chan time.Time {
	return defaultWheel.Tick(d)
}

func (t *Ticker) Stop() {
	t.r.w.delTimer(t.r)
}

func (t *Ticker) Reset(d time.Duration) {
	t.r.w.resetTimer(t.r, d, d)
}