timer

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 6 Imported by: 2

README

timer

Documentation

Index

Constants

View Source
const (
	MinuteSecond = 60                // 一分钟多少秒
	HourSecond   = MinuteSecond * 60 // 一小时多少秒
	DaySeconds   = HourSecond * 24   // 一天多少秒
	WeekSecond   = DaySeconds * 7    // 一个星期多少秒
	MonthSecond  = DaySeconds * 30   // 30天多少秒
	YearSecond   = DaySeconds * 365  // 365天多少秒
)
View Source
const (
	TimeFormat = "2006-01-02 15:04:05"
	DateFormat = "2006-01-02"
)

Variables

This section is empty.

Functions

func GetDayNo

func GetDayNo(year, month, day int, args ...int64) int

GetDayNo 获取从year年,month月,day日到目前或者时间戳args[0]的天数

func Initialize added in v1.0.3

func Initialize(g *group.Group)

func TimeDelta

func TimeDelta(hour, minute, sec int) time.Duration

func TimeHourDelta

func TimeHourDelta(minute, sec int) time.Duration

func TimePreDelta

func TimePreDelta(hour, minute, sec int) (time.Duration, int64)

Types

type CallbackFunc

type CallbackFunc func()

type Timer

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

func AddTicker

func AddTicker(d time.Duration, callback CallbackFunc) *Timer

func AfterFunc

func AfterFunc(d time.Duration, callback CallbackFunc) *Timer

func RunEveryDay

func RunEveryDay(hour, minute, sec int, callback CallbackFunc) *Timer

func RunEveryHour

func RunEveryHour(minute, sec int, callback CallbackFunc) *Timer

func (*Timer) Cancel

func (t *Timer) Cancel()

func (*Timer) GetRemainTime

func (t *Timer) GetRemainTime() time.Duration

func (*Timer) IsActive

func (t *Timer) IsActive() bool

Jump to

Keyboard shortcuts

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