Documentation
¶
Index ¶
- func AfterFunc(duration time.Duration, f func())
- func BeginOfDay(t time.Time) time.Time
- func BeginOfMouth(t time.Time) time.Time
- func BeginOfWeek(t time.Time) time.Time
- func DayPass(begin time.Time, end time.Time) int64
- func EndOfDay(t time.Time) time.Time
- func EndOfWeek(t time.Time) time.Time
- func GetLowPrecisionTime() int64
- func LastDay(t time.Time) time.Time
- func MillisecondToTime(millisecond int64) (h int64, m int64, s int64)
- func NextDay(t time.Time) time.Time
- func SecondToTime(second int64) (h int64, m int64, s int64)
- func StartLowPrecisionTime()
- func Ticker(duration time.Duration, f func() bool)
- func TimeStampToString(nTimer int64) string
- func UntilFunc(t time.Time, f func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AfterFunc ¶
AfterFunc schedules f to run in a new goroutine after the given duration, mirroring the standard library's time.AfterFunc but using a pooled tickerElem to reduce allocation pressure. If f is nil the call is a no-op. Written by Claude Code claude-opus-4-6.
func BeginOfDay ¶
BeginOfDay returns a Time representing 00:00:00.000000000 on the same calendar day and in the same location as t. Written by Claude Code claude-opus-4-6.
func BeginOfMouth ¶
BeginOfMouth returns a Time representing 00:00:00 on the first day of the month containing t, in the same location as t. Written by Claude Code claude-opus-4-6.
func BeginOfWeek ¶
BeginOfWeek returns a Time representing 00:00:00 on the Monday of the week that contains t, in the same location as t. Weeks start on Monday following the ISO-8601 convention. Written by Claude Code claude-opus-4-6.
func DayPass ¶
DayPass returns the number of calendar days that have elapsed between begin and end, measured from midnight of each day so partial days at the ends are counted correctly. The result is negative when end is before begin. Written by Claude Code claude-opus-4-6.
func EndOfDay ¶
EndOfDay returns a Time representing 23:59:59.999999999 on the same calendar day and in the same location as t. Written by Claude Code claude-opus-4-6.
func EndOfWeek ¶
EndOfWeek returns a Time representing 23:59:59.999999999 on the Sunday of the week that contains t, in the same location as t. Written by Claude Code claude-opus-4-6.
func GetLowPrecisionTime ¶ added in v0.1.32
func GetLowPrecisionTime() int64
GetLowPrecisionTime returns the cached Unix timestamp (seconds since epoch) last written by the background ticker started with StartLowPrecisionTime. If StartLowPrecisionTime has not been called the returned value is zero. Written by Claude Code claude-opus-4-6.
func LastDay ¶
LastDay returns a Time exactly 24 hours before t, preserving the time-of-day and location. Written by Claude Code claude-opus-4-6.
func MillisecondToTime ¶
MillisecondToTime converts a millisecond duration to hours, minutes, and seconds by truncating to the nearest second and delegating to SecondToTime. Written by Claude Code claude-opus-4-6.
func NextDay ¶
NextDay returns a Time exactly 24 hours after t, preserving the time-of-day and location. Use this for simple arithmetic; for DST-aware "tomorrow at the same clock time" use AddDate(0, 0, 1) instead. Written by Claude Code claude-opus-4-6.
func SecondToTime ¶
SecondToTime decomposes a duration expressed in whole seconds into its constituent hours, minutes, and seconds components. Hours are not capped at 23 — values larger than 86399 yield h > 23. Written by Claude Code claude-opus-4-6.
func StartLowPrecisionTime ¶ added in v0.1.32
func StartLowPrecisionTime()
StartLowPrecisionTime initialises the background ticker that keeps the low-precision clock up to date. It is idempotent — repeated calls are safe and only the first call starts the ticker. Callers should invoke this once at program startup before using GetLowPrecisionTime. Written by Claude Code claude-opus-4-6.
func Ticker ¶
Ticker invokes f repeatedly at the given interval. f must return true to continue ticking and false to stop. The first invocation happens after one interval, not immediately. If f is nil the call is a no-op. Written by Claude Code claude-opus-4-6.
func TimeStampToString ¶
TimeStampToString converts a Unix timestamp (seconds since epoch) to a human-readable string formatted as "2006-01-02 15:04:05" in the local timezone. Written by Claude Code claude-opus-4-6.
Types ¶
This section is empty.