time

package
v0.0.0-...-2b30333 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Debug = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Timer

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

func NewTimer

func NewTimer(num int) (t *Timer)

A heap must be initialized before any of the heap operations can be used. Init is idempotent with respect to the heap invariants and may be called whenever the heap invariants may have been invalidated. Its complexity is O(n) where n = h.Len().

func (*Timer) Add

func (t *Timer) Add(expire itime.Duration, fn func()) (td *TimerData)

Push pushes the element x onto the heap. The complexity is O(log(n)) where n = h.Len().

func (*Timer) Del

func (t *Timer) Del(td *TimerData)

Del removes the element at index i from the heap. The complexity is O(log(n)) where n = h.Len().

func (*Timer) Init

func (t *Timer) Init(num int)

Init init the timer.

func (*Timer) Set

func (t *Timer) Set(td *TimerData, expire itime.Duration)

Set update timer data.

type TimerData

type TimerData struct {
	Key string
	// contains filtered or unexported fields
}

func (*TimerData) Delay

func (td *TimerData) Delay() itime.Duration

func (*TimerData) ExpireString

func (td *TimerData) ExpireString() string

Jump to

Keyboard shortcuts

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