timestamp

package
v1.26.2-124.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: MIT Imports: 8 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 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 TimeValuePtr added in v1.25.0

func TimeValuePtr(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

func ValidateProtoDuration added in v1.26.2

func ValidateProtoDuration(d *durationpb.Duration) error

ValidateProtoDuration checks protobuf durations for two conditions:

  1. the seconds and nanos fields have the same sign (to avoid serialization issues)
  2. the golang representation of the duration is not negative

nil durations are considered valid because they will be treated as the zero value. durationpb.CheckValid cannot be used directly because it will return an error for very large durations but we are okay with truncating these. durationpb.AsDuration() caps the upper bound for timers at 10,000 years to prevent overflow.

Types

This section is empty.

Jump to

Keyboard shortcuts

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