Documentation ¶
Index ¶
- Constants
- func DebugAddTimeDuration(d Duration) error
- func DebugSetNowTime(timeStr string, local *Location) error
- func DebugSetNowTimeLocal(timeStr string) error
- func DebugSetNowTimeUTC(timeStr string) error
- func Sleep(d Duration)
- type Duration
- type Location
- type Time
- type Timer
- func NewTick(ctx any, h TimerHandler, dur Duration, repeat int) Timer
- func NewTickWithFirstDo(ctx any, h TimerHandler, firstFireAt time.Time, dur Duration, repeat int) Timer
- func NewTimer(ctx any, h TimerHandler, dur Duration) Timer
- func NewTimerWithFirstDo(ctx any, h TimerHandler, fireAt time.Time) Timer
- type TimerChannel
- type TimerHandler
- type TimerMsg
Constants ¶
View Source
const ( Nanosecond = time.Nanosecond Microsecond = time.Microsecond Millisecond = time.Millisecond Second = time.Second Minute = time.Minute Hour = time.Hour Day = 24 * time.Hour )
View Source
const InfiniteTimes = tools.InfiniteTimes
View Source
const Layout = "2006-01-02 15:04:05.000"
View Source
const LayoutSec = "2006-01-02 15:04:05"
Variables ¶
This section is empty.
Functions ¶
func DebugAddTimeDuration ¶
func DebugSetNowTime ¶
func DebugSetNowTimeLocal ¶
func DebugSetNowTimeUTC ¶
Types ¶
type Timer ¶
type Timer = heap_timer.Timer
func NewTickWithFirstDo ¶
func NewTimer ¶
func NewTimer(ctx any, h TimerHandler, dur Duration) Timer
NewTimer 创建一个定时器, 返回的Timer只能在指定goroutine中操作Reset和 Kill
func NewTimerWithFirstDo ¶
func NewTimerWithFirstDo(ctx any, h TimerHandler, fireAt time.Time) Timer
type TimerChannel ¶
type TimerChannel = heap_timer.TimerChannel
type TimerHandler ¶
type TimerHandler interface {
OnTime(msg TimerMsg)
}
type TimerMsg ¶
type TimerMsg = heap_timer.TimerMsg
Click to show internal directories.
Click to hide internal directories.