Documentation
¶
Index ¶
- Constants
- func Epoch(t time.Time) float64
- func FromEpoch(ts float64) time.Time
- func Monotonic() float64
- func ParseISO(s string, loc *time.Location) (time.Time, error)
- func ParseISOZone(s string, loc *time.Location) (time.Time, bool, error)
- func RelativeAge(v any, sessionID string, now time.Time) string
- func StoredEpoch(v any, sessionID, field string) (float64, bool)
- func Strftime(t time.Time, format string) string
- func StrictDate(year int, month time.Month, day, hour, minute, second, nsec int, ...) (time.Time, error)
- func YAMLTimestamp(text string) (v any, ok bool, err error)
- type Date
- type ParseError
- type RangeError
Constants ¶
const RFC3339Micro = "2006-01-02T15:04:05.000000Z07:00"
Layout of RFC 3339 text with exactly six fractional digits and Z for a zero offset, fixed width so stamps of one offset sort as text in time order
Variables ¶
This section is empty.
Functions ¶
func Epoch ¶
Seconds since the Unix epoch of t as a float, to the nanosecond as far as a float64 holds it
func FromEpoch ¶
Local instant of float seconds since the Unix epoch to the nanosecond, the zero Time for NaN, infinities and instants outside the years 1 to 9999
func Monotonic ¶
func Monotonic() float64
Seconds on the system monotonic clock counted from boot, so a zero stamp always reads as long ago and the difference of two readings is the elapsed time
func ParseISO ¶
Instant of ISO 8601 text, a calendar, week or ordinal date alone or with a time of day, read as wall time in loc when the text carries no UTC offset and in UTC when loc is nil too; 24:00 is the next midnight and a leap second :60 the first instant of the next minute
func ParseISOZone ¶
Instant of ISO 8601 text as ParseISO reads it, also reporting whether the text carried Z or a UTC offset
func RelativeAge ¶
Age of a stored timestamp cell as just now, 5m ago, 3h ago, yesterday or 4d ago, its local date when older and ? when unset, zero or corrupt
func StoredEpoch ¶
Epoch seconds a stored timestamp cell holds, false for unset and corrupt values, a warning naming the field and session logged for corrupt ones
func Strftime ¶
Text of t laid out by a C strftime format in the C locale: the glibc conversions with their _ - 0 ^ # flags, widths and E or O modifiers, plus %f for microseconds and %:z for a colon offset; an unknown conversion stays as written
Types ¶
type Date ¶
Calendar date with no time of day, what a bare YAML date such as 2001-12-14 loads to
func (Date) MarshalText ¶
Date in yyyy-mm-dd form, so JSON and other text encoders write it as a plain date string
type ParseError ¶
Text that is not a date or time of the form a parser expects, Err holding the *RangeError when a field is out of range
func (*ParseError) Error ¶
func (e *ParseError) Error() string
Form expected, the text quoted and the out of range field when that is the reason
func (*ParseError) Unwrap ¶
func (e *ParseError) Unwrap() error
Out of range field error the text failed on, nil for a syntax error
type RangeError ¶
Calendar or clock field outside its range
func (*RangeError) Error ¶
func (e *RangeError) Error() string
Field name, its allowed range and the value given