timeutil

package
v0.0.0-...-bc7ff53 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DatetimeFormat = "2006-01-02 15:04:05"
	DateFormat     = "2006-01-02"
	DateDayFormat  = "20060102"
	TimeFormat     = "15:04:05"
)

Variables

This section is empty.

Functions

func Date

func Date() string

func DateNumber

func DateNumber() string

func DateTime

func DateTime() string

func DayEndDateTime

func DayEndDateTime() string

func DayEndTime

func DayEndTime() int64

func DayStartDateTime

func DayStartDateTime() string

func DayStartTime

func DayStartTime() int64

func FormatDatetime

func FormatDatetime(t time.Time) string

func IsDateFormat

func IsDateFormat(date string) bool

func IsDateTimeFormat

func IsDateTimeFormat(datetime string) bool

func Location

func Location() *time.Location

func ParseDateTime

func ParseDateTime(datetime string) time.Time

func Time

func Time() string

func Unix

func Unix(t time.Time) int64

func UnixNow

func UnixNow() int64

Types

type Handler

type Handler func(*TimeWheel, any)

type SimpleHandler

type SimpleHandler[T any] func(*SimpleTimeWheel[T], string, T)

type SimpleTimeWheel

type SimpleTimeWheel[T any] struct {
	// contains filtered or unexported fields
}

func NewSimpleTimeWheel

func NewSimpleTimeWheel[T any](delay time.Duration, numSlot int, handler SimpleHandler[T]) *SimpleTimeWheel[T]

func (*SimpleTimeWheel[T]) Add

func (s *SimpleTimeWheel[T]) Add(key string, value T, delay time.Duration)

func (*SimpleTimeWheel[T]) Remove

func (s *SimpleTimeWheel[T]) Remove(key string)

func (*SimpleTimeWheel[T]) Start

func (s *SimpleTimeWheel[T]) Start()

func (*SimpleTimeWheel[T]) Stop

func (s *SimpleTimeWheel[T]) Stop()

type TimeWheel

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

func NewTimeWheel

func NewTimeWheel(handler Handler) *TimeWheel

func (*TimeWheel) Add

func (t *TimeWheel) Add(task any, delay time.Duration) error

func (*TimeWheel) Remove

func (t *TimeWheel) Remove(task any)

func (*TimeWheel) Start

func (t *TimeWheel) Start()

func (*TimeWheel) Stop

func (t *TimeWheel) Stop()

Jump to

Keyboard shortcuts

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