xtime

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2021 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Overview

https://github.com/siddontang/go/tree/master/time2

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func After

func After(d time.Duration) <-chan time.Time

After ...

func Duration

func Duration(str string) time.Duration

Duration ... panic if parse duration failed

func NewRashTimer

func NewRashTimer(tick time.Duration) *rashTimer

NewRashTimer is the time for a jiffies

func Sleep

func Sleep(d time.Duration)

Sleep ...

func Tick

func Tick(d time.Duration) <-chan time.Time

Tick ...

Types

type Ticker

type Ticker struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

Ticker ...

func NewTicker

func NewTicker(d time.Duration) *Ticker

NewTicker ...

func TickFunc

func TickFunc(d time.Duration, f func()) *Ticker

TickFunc ...

func (*Ticker) Reset

func (t *Ticker) Reset(d time.Duration)

Reset ...

func (*Ticker) Stop

func (t *Ticker) Stop()

Stop ...

type Time

type Time struct {
	time.Time
}

Time time

func Now

func Now() *Time

Now returns current time

func Today

func Today() *Time

Today returns begin time of today

func Unix

func Unix(sec, nsec int64) *Time

Unix returns time converted from timestamp

func (*Time) BeginOfDay

func (t *Time) BeginOfDay() *Time

BeginOfDay returns zero point of time's day

func (*Time) BeginOfHour

func (t *Time) BeginOfHour() *Time

BeginOfHour returns zero point of time's day

func (*Time) BeginOfMinute

func (t *Time) BeginOfMinute() *Time

BeginOfMinute returns zero point of time's day

func (*Time) BeginOfMonth

func (t *Time) BeginOfMonth() *Time

BeginOfMonth begin of month

func (*Time) BeginOfWeek

func (t *Time) BeginOfWeek() *Time

BeginOfWeek the day of begin of week, NOTE(lvchao) not zero time

func (*Time) BeginOfYear

func (t *Time) BeginOfYear() *Time

BeginOfYear BeginOfYear beginning of year

func (*Time) EndOfDay

func (t *Time) EndOfDay() *Time

EndOfDay returns last point of time's day

func (*Time) EndOfHour

func (t *Time) EndOfHour() *Time

EndOfHour returns last point of time's day

func (*Time) EndOfMinute

func (t *Time) EndOfMinute() *Time

EndOfMinute returns last point of time's day

func (*Time) EndOfMonth

func (t *Time) EndOfMonth() *Time

EndOfMonth end of month

func (*Time) EndOfWeek

func (t *Time) EndOfWeek() *Time

EndOfWeek end of week

func (*Time) EndOfYear

func (t *Time) EndOfYear() *Time

EndOfYear end of year

type Timer

type Timer struct {
	C <-chan time.Time
	// contains filtered or unexported fields
}

Timer ...

func AfterFunc

func AfterFunc(d time.Duration, f func()) *Timer

AfterFunc ...

func NewTimer

func NewTimer(d time.Duration) *Timer

NewTimer ...

func (*Timer) Reset

func (t *Timer) Reset(d time.Duration)

Reset ...

func (*Timer) Stop

func (t *Timer) Stop()

Stop ...

Jump to

Keyboard shortcuts

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