timestamp

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2020 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

View Source
const MaxValidTimeNanoseconds = (2 ^ (64 - 1)) - 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Timestamp

type Timestamp struct {
	// contains filtered or unexported fields
}

Timestamp provides easy conversions and utility comparison functions making go to proto time comparison straightforward

func TimestampEpoch

func TimestampEpoch() *Timestamp

TimestampEpoch returns the unix epoch - TimestampFromTime(time.Unix(0, 0)) noinspection GoNameStartsWithPackageName

func TimestampFromProto

func TimestampFromProto(ts *types.Timestamp) *Timestamp

TimestampFromProto returns a Timestamp from proto time noinspection GoNameStartsWithPackageName

func TimestampFromTime

func TimestampFromTime(t *time.Time) *Timestamp

TimestampFromTime returns a Timestamp from a time.time noinspection GoNameStartsWithPackageName

func TimestampNow

func TimestampNow() *Timestamp

TimestampNow returns a timestamp that represents Now() noinspection GoNameStartsWithPackageName

func TimestampNowAddSeconds

func TimestampNowAddSeconds(seconds int64) *Timestamp

TimestampNowAddSeconds returns a timestamp that represents Now() + some number of seconds noinspection GoNameStartsWithPackageName

func (*Timestamp) After

func (t1 *Timestamp) After(t2 *Timestamp) bool

Before returns true when t1 is after t2, false otherwise noinspection GoReceiverNames

func (*Timestamp) Before

func (t1 *Timestamp) Before(t2 *Timestamp) bool

Before returns true when t1 is before t2, false otherwise noinspection GoReceiverNames

func (*Timestamp) SameAs

func (t1 *Timestamp) SameAs(t2 *Timestamp) bool

SamesAs returns true when t1 is the same time as t2, false otherwise noinspection GoReceiverNames

func (*Timestamp) ToProto

func (t *Timestamp) ToProto() *types.Timestamp

ToProto returns the proto representation noinspection GoReceiverNames

func (*Timestamp) ToTime

func (t *Timestamp) ToTime() *time.Time

ToTime returns the time.time representation noinspection GoReceiverNames

func (*Timestamp) UnixNano

func (t *Timestamp) UnixNano() int64

UnixNano returns the int64 representation of nanoseconds since 1970 (see time.UnixNano) noinspection GoReceiverNames

Jump to

Keyboard shortcuts

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