Documentation ¶
Overview ¶
Package timefmt provides types for representing time formats in JSON.
Index ¶
- func Append(b []byte, t time.Time, unit Unit, epoch Epoch) []byte
- func Format(t time.Time, unit Unit, epoch Epoch) string
- func FormatBytes(t time.Time, unit Unit, epoch Epoch) []byte
- func FromInt(n, nsec int64, unit Unit, epoch Epoch) time.Time
- func Parse(s string, unit Unit, epoch Epoch) (time.Time, error)
- func ToInt(t time.Time, unit Unit, epoch Epoch) (n, nsec int64)
- type Chrome
- type Epoch
- type QuotedChrome
- type Unit
- type UnixMicro
- type UnixMilli
- type UnixNano
- type UnixSec
- type WindowsMicro
- type WindowsMilli
- type WindowsNano
- type WindowsSec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Chrome ¶
type Chrome = WindowsMicro
Chrome is a time that is formatted in json as an integer representing an internal Chrome time in microseconds since 1601-01-01 00:00:00 UTC.
type QuotedChrome ¶
QuotedChrome is a time that is formatted in json as a quoted integer representing an internal Chrome time in microseconds since 1601-01-01 00:00:00 UTC.
func (QuotedChrome) MarshalJSON ¶
func (t QuotedChrome) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (QuotedChrome) MarshalText ¶
func (t QuotedChrome) MarshalText() ([]byte, error)
MarshalText implements the text.Marshaler interface.
func (*QuotedChrome) UnmarshalJSON ¶
func (t *QuotedChrome) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*QuotedChrome) UnmarshalText ¶
func (t *QuotedChrome) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type UnixMicro ¶
UnixMicro is a time that is formatted as an integer representing a Unix time in microseconds since 1970-01-01 00:00:00 UTC.
func (UnixMicro) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (UnixMicro) MarshalText ¶
MarshalText implements the text.Marshaler interface.
func (*UnixMicro) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*UnixMicro) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type UnixMilli ¶
UnixMilli is a time that is formatted as an integer representing a Unix time in milliseconds since 1970-01-01 00:00:00 UTC.
func (UnixMilli) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (UnixMilli) MarshalText ¶
MarshalText implements the text.Marshaler interface.
func (*UnixMilli) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*UnixMilli) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type UnixNano ¶
UnixNano is a time that is formatted as an integer representing a Unix time in nanoseconds since 1970-01-01 00:00:00 UTC.
func (UnixNano) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (UnixNano) MarshalText ¶
MarshalText implements the text.Marshaler interface.
func (*UnixNano) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*UnixNano) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type UnixSec ¶
UnixSec is a time that is formatted as an integer representing a Unix time in seconds since 1970-01-01 00:00:00 UTC.
func (UnixSec) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface.
func (UnixSec) MarshalText ¶
MarshalText implements the text.Marshaler interface.
func (*UnixSec) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface.
func (*UnixSec) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type WindowsMicro ¶
WindowsMicro is a time that is formatted as an integer representing a Windows time in microseconds since 1601-01-01 00:00:00 UTC.
func (WindowsMicro) Epoch ¶
func (t WindowsMicro) Epoch() Epoch
Epoch returns the epoch that times are relative to. Always Windows.
func (WindowsMicro) MarshalJSON ¶
func (t WindowsMicro) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (WindowsMicro) MarshalText ¶
func (t WindowsMicro) MarshalText() ([]byte, error)
MarshalText implements the text.Marshaler interface.
func (WindowsMicro) Unit ¶
func (t WindowsMicro) Unit() Unit
Unit returns the unit that times are measured in. Always Micro.
func (*WindowsMicro) UnmarshalJSON ¶
func (t *WindowsMicro) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*WindowsMicro) UnmarshalText ¶
func (t *WindowsMicro) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type WindowsMilli ¶
WindowsMilli is a time that is formatted as an integer representing a Windows time in milliseconds since 1601-01-01 00:00:00 UTC.
func (WindowsMilli) Epoch ¶
func (t WindowsMilli) Epoch() Epoch
Epoch returns the epoch that times are relative to. Always Windows.
func (WindowsMilli) MarshalJSON ¶
func (t WindowsMilli) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (WindowsMilli) MarshalText ¶
func (t WindowsMilli) MarshalText() ([]byte, error)
MarshalText implements the text.Marshaler interface.
func (WindowsMilli) Unit ¶
func (t WindowsMilli) Unit() Unit
Unit returns the unit that times are measured in. Always Milli.
func (*WindowsMilli) UnmarshalJSON ¶
func (t *WindowsMilli) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*WindowsMilli) UnmarshalText ¶
func (t *WindowsMilli) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type WindowsNano ¶
WindowsNano is a time that is formatted as an integer representing a Windows time in nanoseconds since 1601-01-01 00:00:00 UTC.
func (WindowsNano) Epoch ¶
func (t WindowsNano) Epoch() Epoch
Epoch returns the epoch that times are relative to. Always Windows.
func (WindowsNano) MarshalJSON ¶
func (t WindowsNano) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (WindowsNano) MarshalText ¶
func (t WindowsNano) MarshalText() ([]byte, error)
MarshalText implements the text.Marshaler interface.
func (WindowsNano) Unit ¶
func (t WindowsNano) Unit() Unit
Unit returns the unit that times are measured in. Always Nano.
func (*WindowsNano) UnmarshalJSON ¶
func (t *WindowsNano) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*WindowsNano) UnmarshalText ¶
func (t *WindowsNano) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.
type WindowsSec ¶
WindowsSec is a time that is formatted as an integer representing a Windows time in seconds since 1601-01-01 00:00:00 UTC.
func (WindowsSec) Epoch ¶
func (t WindowsSec) Epoch() Epoch
Epoch returns the epoch that times are relative to. Always Windows.
func (WindowsSec) MarshalJSON ¶
func (t WindowsSec) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface.
func (WindowsSec) MarshalText ¶
func (t WindowsSec) MarshalText() ([]byte, error)
MarshalText implements the text.Marshaler interface.
func (WindowsSec) Unit ¶
func (t WindowsSec) Unit() Unit
Unit returns the unit that times are measured in. Always Sec.
func (*WindowsSec) UnmarshalJSON ¶
func (t *WindowsSec) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
func (*WindowsSec) UnmarshalText ¶
func (t *WindowsSec) UnmarshalText(data []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface.