github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/swarmkit/protobuf/ptypes/timestamp.go (about) 1 package ptypes 2 3 import ( 4 "time" 5 6 gogotypes "github.com/gogo/protobuf/types" 7 ) 8 9 // MustTimestampProto converts time.Time to a google.protobuf.Timestamp proto. 10 // It panics if input timestamp is invalid. 11 func MustTimestampProto(t time.Time) *gogotypes.Timestamp { 12 ts, err := gogotypes.TimestampProto(t) 13 if err != nil { 14 panic(err.Error()) 15 } 16 return ts 17 }