timestamp

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 2 Imported by: 8

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func DaysFromDuration added in v0.28.0

func DaysFromDuration(duration *time.Duration) int

func DaysInt32FromDuration added in v0.28.0

func DaysInt32FromDuration(duration *time.Duration) int32

func DurationFromDays added in v0.28.0

func DurationFromDays(d int32) *time.Duration

func DurationFromHours added in v0.28.0

func DurationFromHours(h int64) *time.Duration

func DurationFromMinutes added in v0.28.0

func DurationFromMinutes(m int64) *time.Duration

func DurationFromSeconds added in v0.28.0

func DurationFromSeconds(s int64) *time.Duration

func DurationPtr added in v0.28.0

func DurationPtr(td time.Duration) *time.Duration

func DurationValue added in v0.28.0

func DurationValue(d *time.Duration) time.Duration

func MinDuration added in v0.28.0

func MinDuration(d1 time.Duration, d2 time.Duration) time.Duration

func MinDurationPtr added in v0.28.0

func MinDurationPtr(d1 *time.Duration, d2 *time.Duration) *time.Duration

func RoundUp added in v0.28.0

func RoundUp(d time.Duration) time.Duration

func TimeNowPtrUtc added in v0.28.0

func TimeNowPtrUtc() *time.Time

func TimeNowPtrUtcAddDuration added in v0.28.0

func TimeNowPtrUtcAddDuration(t time.Duration) *time.Time

func TimeNowPtrUtcAddSeconds added in v0.28.0

func TimeNowPtrUtcAddSeconds(seconds int) *time.Time

func TimePtr added in v0.28.0

func TimePtr(t time.Time) *time.Time

func TimeValue added in v0.28.0

func TimeValue(t *time.Time) time.Time

func UnixOrZeroTime added in v0.28.0

func UnixOrZeroTime(nanos int64) time.Time

func UnixOrZeroTimePtr added in v0.28.0

func UnixOrZeroTimePtr(nanos int64) *time.Time

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)).UTC() 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

TimestampFromTimePtr returns a Timestamp from a time.time noinspection GoNameStartsWithPackageName

func TimestampFromTimePtr added in v0.28.0

func TimestampFromTimePtr(t *time.Time) *Timestamp

TimestampFromTimePtr 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