1package ptypes
2
3import (
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.
11func 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}
18