time

package
v0.0.0-...-9b43e00 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Debug debug switch
	Debug = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Duration

type Duration xtime.Duration

Duration be used toml unmarshal string time, like 1s, 500ms.

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

UnmarshalText unmarshal text to duration.

type Timer

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

Timer timer.

func NewTimer

func NewTimer(num int) (t *Timer)

NewTimer new a 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)

Add add 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
}

TimerData timer data.

func (*TimerData) Delay

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

Delay delay duration.

func (*TimerData) ExpireString

func (td *TimerData) ExpireString() string

ExpireString expire string.

Jump to

Keyboard shortcuts

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