github.com/cosmos/cosmos-proto@v1.0.0-beta.3/support/timepb/README.md (about) 1 # timepb 2 3 `timepb` is a Go package that provides functions to do time operations with 4 [protobuf timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#timestamp) 5 and [protobuf duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration) 6 structures. 7 8 ### Example 9 10 ``` go 11 t1 := &tspb.Timestamp{Seconds: 10, Nanos: 1} 12 d := &durpb.Duration{Seconds: 1, Nanos: 1e9 - 1} 13 t2 := Add(t1, d) 14 15 fmt.Println(Compare(&tspb.Timestamp{Seconds: 12, Nanos: 0}, t2) == 0) 16 fmt.Println(Compare(&tspb.Timestamp{Seconds: 10, Nanos: 1}, t1) == 0) 17 fmt.Println(Compare(t1, t2)) 18 // Output: 19 // true 20 // true 21 // -1 22 ``` 23