package
1.0.0-beta.5
Repository: https://github.com/cosmos/cosmos-proto.git
Documentation: pkg.go.dev

# README

timepb

timepb is a Go package that provides functions to do time operations with protobuf timestamp and protobuf duration structures.

Example

t1 := &tspb.Timestamp{Seconds: 10, Nanos: 1}
d := &durpb.Duration{Seconds: 1, Nanos: 1e9 - 1}
t2 := Add(t1, d)

fmt.Println(Compare(&tspb.Timestamp{Seconds: 12, Nanos: 0}, t2) == 0)
fmt.Println(Compare(&tspb.Timestamp{Seconds: 10, Nanos: 1}, t1) == 0)
fmt.Println(Compare(t1, t2))
// Output:
// true
// true
// -1