timebp

package
v0.9.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Overview

Package timebp defines some time related types used by various baseplate components, along with their helper functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MicrosecondsToTime

func MicrosecondsToTime(us int64) time.Time

MicrosecondsToTime converts milliseconds since EPOCH to time.Time.

func MillisecondsToTime

func MillisecondsToTime(ms int64) time.Time

MillisecondsToTime converts milliseconds since EPOCH to time.Time.

func SecondsToTimeF

func SecondsToTimeF(s float64) time.Time

SecondsToTimeF converts float seconds since EPOCH to time.Time.

func TimeToMicroseconds

func TimeToMicroseconds(t time.Time) int64

TimeToMicroseconds converts time.Time to microseconds since EPOCH.

func TimeToMilliseconds

func TimeToMilliseconds(t time.Time) int64

TimeToMilliseconds converts time.Time to milliseconds since EPOCH.

func TimeToSecondsF

func TimeToSecondsF(t time.Time) float64

TimeToSecondsF converts time.Time to float seconds since EPOCH.

Types

type DurationMicrosecond

type DurationMicrosecond time.Duration

DurationMicrosecond implements json/text encoding/decoding using microseconds as int.

func (DurationMicrosecond) MarshalJSON

func (zd DurationMicrosecond) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler interface, using microseconds.

func (DurationMicrosecond) MarshalText added in v0.8.1

func (zd DurationMicrosecond) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

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.

func (*DurationMicrosecond) UnmarshalText added in v0.8.1

func (zd *DurationMicrosecond) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type TimestampMicrosecond

type TimestampMicrosecond time.Time

TimestampMicrosecond implements json/text 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) MarshalText added in v0.8.1

func (ts TimestampMicrosecond) MarshalText() ([]byte, error)

MarshalText implemnts encoding.TextMarshaler.

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.

func (*TimestampMicrosecond) UnmarshalText added in v0.8.1

func (ts *TimestampMicrosecond) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type TimestampMillisecond

type TimestampMillisecond time.Time

TimestampMillisecond implements json/text encoding/decoding using milliseconds since EPOCH.

func (TimestampMillisecond) MarshalJSON

func (ts TimestampMillisecond) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (TimestampMillisecond) MarshalText added in v0.8.1

func (ts TimestampMillisecond) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

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.

func (*TimestampMillisecond) UnmarshalText added in v0.8.1

func (ts *TimestampMillisecond) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type TimestampSecondF

type TimestampSecondF time.Time

TimestampSecondF implements json/text 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) MarshalText added in v0.8.1

func (ts TimestampSecondF) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

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.

func (*TimestampSecondF) UnmarshalText added in v0.8.1

func (ts *TimestampSecondF) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL