timebp

package
v0.0.0-...-bde19ca Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: BSD-3-Clause Imports: 4 Imported by: 0

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 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

type TimestampMicrosecond time.Time

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

type TimestampMillisecond time.Time

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

type TimestampSecondF time.Time

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.

Jump to

Keyboard shortcuts

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