Documentation
¶
Overview ¶
Package libtime provides immutable wall-clock timestamps and duration operations. Owned timestamps preserve timezone/calendar rules without exposing shared mutable Go timezone objects; use Time and Get at Go boundaries.
Index ¶
- Constants
- func BuiltinDurationBetween(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinDurationMS(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinDurationNS(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinDurationSeconds(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinFormatRFC3339(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinFormatRFC3339Nano(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinParseDuration(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinParseRFC3339(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinParseRFC3339Nano(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinSleep(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinTimeAdd(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinTimeEq(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinTimeGT(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func BuiltinTimeLT(env *lisp.LEnv, args *lisp.LVal) *lisp.LVal
- func Duration(d time.Duration) *lisp.LVal
- func Get(v *lisp.LVal) (time.Time, bool)
- func GetDuration(v *lisp.LVal) (time.Duration, bool)
- func LoadPackage(env *lisp.LEnv) *lisp.LVal
- func Time(t time.Time) *lisp.LVal
Constants ¶
const DefaultPackageName = "time"
DefaultPackageName is the package name used by LoadPackage.
Variables ¶
This section is empty.
Functions ¶
func BuiltinDurationBetween ¶
func BuiltinDurationMS ¶
BuiltinDuriationNS returns a float equal to the the number of nanoseconds in the given duration.
func BuiltinDurationNS ¶
BulitinDuriationNS returns an integer equal to the the number of nanoseconds in the given duration.
func BuiltinDurationSeconds ¶
BulitinDurationSecods returns a float equal to the the number of seconds in the given duration.
func BuiltinParseRFC3339Nano ¶
func BuiltinSleep ¶
BuiltinSleep sleeps for the given duration before returning.
LoadPackage does not register it: the time package offers no builtin whose result depends on goroutine timing (#757). It stays exported for hosts that register a sleep in their own package, with formals (time-duration &key max).
The sleep is bounded by the evaluation's context (see LEnv.Context): it wakes early if the context is cancelled, and never sleeps past the context's deadline. See sleepContext for the full rationale.
func Get ¶
Get returns a Go time.Time with an independent timezone object. Mutating its Location cannot change v or another export. The timezone's value is preserved, not its pointer identity. Nil and non-native values return the zero time and false. Raw host time.Time natives remain supported, but are not automatically approved for template sharing.
func GetDuration ¶
GetDuration gets a time.Duration value from v and returns it.
func LoadPackage ¶
LoadPackage adds the time package to env
func Time ¶
Time creates an immutable native wall-clock value representing t. It takes an independent snapshot of t's timezone object, preserving named-zone and daylight-saving rules but dropping Go monotonic clock metadata. The native payload is private; use Get to obtain an independent Go time.Time value. Callers must not mutate t's timezone concurrently with this call. This does not make capturing wall-clock time during template initialization equivalent to reading the clock independently during each cold load.
Types ¶
This section is empty.