Documentation ¶
Overview ¶
Package timebp defines some time related types used by various baseplate components, along with their helper functions.
Index ¶
- func MicrosecondsToTime(us int64) time.Time
- func MillisecondsToTime(ms int64) time.Time
- func SecondsToTimeF(s float64) time.Time
- func TimeToMicroseconds(t time.Time) int64
- func TimeToMilliseconds(t time.Time) int64
- func TimeToSecondsF(t time.Time) float64
- type DurationMicrosecond
- type TimestampMicrosecond
- type TimestampMillisecond
- type TimestampSecondF
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MicrosecondsToTime ¶
MicrosecondsToTime converts milliseconds since EPOCH to time.Time.
func MillisecondsToTime ¶
MillisecondsToTime converts milliseconds since EPOCH to time.Time.
func SecondsToTimeF ¶
SecondsToTimeF converts float seconds since EPOCH to time.Time.
func TimeToMicroseconds ¶
TimeToMicroseconds converts time.Time to microseconds since EPOCH.
func TimeToMilliseconds ¶
TimeToMilliseconds converts time.Time to milliseconds since EPOCH.
func TimeToSecondsF ¶
TimeToSecondsF converts time.Time to float seconds since EPOCH.
Types ¶
type DurationMicrosecond ¶
DurationMicrosecond implements json encoding/decoding using microseconds as int.
func (DurationMicrosecond) MarshalJSON ¶
func (zd DurationMicrosecond) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface, using microseconds.
func (DurationMicrosecond) String ¶
func (zd DurationMicrosecond) String() string
func (DurationMicrosecond) ToDuration ¶
func (zd DurationMicrosecond) ToDuration() time.Duration
ToDuration converts DurationMicrosecond back to time.Duration.
func (*DurationMicrosecond) UnmarshalJSON ¶
func (zd *DurationMicrosecond) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler interface.
type TimestampMicrosecond ¶
TimestampMicrosecond implements json encoding/decoding using microseconds since EPOCH.
func (TimestampMicrosecond) MarshalJSON ¶
func (ts TimestampMicrosecond) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface, using epoch microseconds.
func (TimestampMicrosecond) String ¶
func (ts TimestampMicrosecond) String() string
func (TimestampMicrosecond) ToTime ¶
func (ts TimestampMicrosecond) ToTime() time.Time
ToTime converts TimestampMicrosecond back to time.Time.
func (*TimestampMicrosecond) UnmarshalJSON ¶
func (ts *TimestampMicrosecond) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler interface.
type TimestampMillisecond ¶
TimestampMillisecond implements json encoding/decoding using milliseconds since EPOCH.
func (TimestampMillisecond) MarshalJSON ¶
func (ts TimestampMillisecond) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (TimestampMillisecond) String ¶
func (ts TimestampMillisecond) String() string
func (TimestampMillisecond) ToTime ¶
func (ts TimestampMillisecond) ToTime() time.Time
ToTime converts TimestampMillisecond back to time.Time.
func (*TimestampMillisecond) UnmarshalJSON ¶
func (ts *TimestampMillisecond) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type TimestampSecondF ¶
TimestampSecondF implements json encoding/decoding using float number seconds since EPOCH, with precision up to microseconds.
func (TimestampSecondF) MarshalJSON ¶
func (ts TimestampSecondF) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (TimestampSecondF) String ¶
func (ts TimestampSecondF) String() string
func (TimestampSecondF) ToTime ¶
func (ts TimestampSecondF) ToTime() time.Time
ToTime converts TimestampSecondF back to time.Time.
func (*TimestampSecondF) UnmarshalJSON ¶
func (ts *TimestampSecondF) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.