timestamp

package
v1.23.0-rc15 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DaysFromDuration added in v0.28.0

func DaysFromDuration(duration *durationpb.Duration) int

func DaysInt32FromDuration added in v0.28.0

func DaysInt32FromDuration(duration *durationpb.Duration) int32

func DurationFromDays added in v0.28.0

func DurationFromDays(d int32) *durationpb.Duration

func DurationFromHours added in v0.28.0

func DurationFromHours(h int64) *durationpb.Duration

func DurationFromMinutes added in v0.28.0

func DurationFromMinutes(m int64) *durationpb.Duration

func DurationFromSeconds added in v0.28.0

func DurationFromSeconds(s int64) *durationpb.Duration

func DurationPtr added in v0.28.0

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

func DurationValue added in v0.28.0

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

func MinDurationPtr added in v0.28.0

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

func ParseDuration added in v1.11.0

func ParseDuration(s string) (time.Duration, error)

ParseDuration is like time.ParseDuration, but supports unit "d" for days (always interpreted as exactly 24 hours).

func ParseDurationDefaultDays added in v1.11.0

func ParseDurationDefaultDays(s string) (time.Duration, error)

ParseDurationDefaultDays is like time.ParseDuration, but supports unit "d" for days (always interpreted as exactly 24 hours), and also supports unit-less numbers, which are interpreted as days.

func ParseDurationDefaultSeconds added in v1.21.0

func ParseDurationDefaultSeconds(s string) (time.Duration, error)

ParseDurationDefaultSeconds is like time.ParseDuration, but supports unit "d" for days (always interpreted as exactly 24 hours), and also supports unit-less numbers, which are interpreted as seconds.

func ParseHHMMSSDuration added in v1.23.0

func ParseHHMMSSDuration(d string) (time.Duration, error)

func RoundUp added in v0.28.0

func RoundUp(d time.Duration) time.Duration

func TimeNowPtrUtc added in v0.28.0

func TimeNowPtrUtc() *timestamppb.Timestamp

func TimeNowPtrUtcAddDuration added in v0.28.0

func TimeNowPtrUtcAddDuration(t time.Duration) *timestamppb.Timestamp

func TimeNowPtrUtcAddSeconds added in v0.28.0

func TimeNowPtrUtcAddSeconds(seconds int) *timestamppb.Timestamp

func TimePtr added in v0.28.0

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

func TimeValue added in v0.28.0

func TimeValue(t *timestamppb.Timestamp) 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) *timestamppb.Timestamp

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 *timestamppb.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() *timestamppb.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