Documentation ¶
Overview ¶
Index ¶
- Constants
- func After(d time.Duration) <-chan time.Time
- func CurrentTimeMillis() uint64
- func CurrentTimeMillsWithTicker() uint64
- func CurrentTimeNano() uint64
- func Duration(str string) time.Duration
- func Elapse(f func()) int64
- func FormatDate(tsMillis uint64) string
- func FormatTimeMillis(tsMillis uint64) string
- func GetTimestampInMilli() int64
- func IsLeapYear(year int) bool
- func NewRashTimer(tick time.Duration) *rashTimer
- func Sleep(d time.Duration)
- func StartTimeTicker()
- func Tick(d time.Duration) <-chan time.Time
- type Ticker
- type Time
- func (t *Time) BeginOfDay() *Time
- func (t *Time) BeginOfHour() *Time
- func (t *Time) BeginOfMinute() *Time
- func (t *Time) BeginOfMonth() *Time
- func (t *Time) BeginOfWeek() *Time
- func (t *Time) BeginOfYear() *Time
- func (t *Time) EndOfDay() *Time
- func (t *Time) EndOfHour() *Time
- func (t *Time) EndOfMinute() *Time
- func (t *Time) EndOfMonth() *Time
- func (t *Time) EndOfWeek() *Time
- func (t *Time) EndOfYear() *Time
- type TimeFormat
- type Timer
Constants ¶
const ( DateFormat = "2006-01-02" UnixTimeUnitOffset = uint64(time.Millisecond / time.Nanosecond) )
Variables ¶
This section is empty.
Functions ¶
func CurrentTimeMillis ¶
func CurrentTimeMillis() uint64
Returns the current Unix timestamp in milliseconds.
func CurrentTimeMillsWithTicker ¶
func CurrentTimeMillsWithTicker() uint64
func CurrentTimeNano ¶
func CurrentTimeNano() uint64
Returns the current Unix timestamp in nanoseconds.
func FormatDate ¶
FormatDate formats Unix timestamp (ms) to date string
func FormatTimeMillis ¶
FormatTimeMillis formats Unix timestamp (ms) to time string.
func NewRashTimer ¶
NewRashTimer is the time for a jiffies
func StartTimeTicker ¶
func StartTimeTicker()
StartTimeTicker starts a background task that caches current timestamp per millisecond, which may provide better performance in high-concurrency scenarios.
Types ¶
type Time ¶
Time time
func (*Time) BeginOfDay ¶
BeginOfDay returns zero point of time's day
func (*Time) BeginOfHour ¶
BeginOfHour returns zero point of time's day
func (*Time) BeginOfMinute ¶
BeginOfMinute returns zero point of time's day
func (*Time) BeginOfWeek ¶
BeginOfWeek the day of begin of week, NOTE: week begin from Sunday
func (*Time) BeginOfYear ¶
BeginOfYear BeginOfYear beginning of year
func (*Time) EndOfMinute ¶
EndOfMinute returns last point of time's day