ProtoTime converts a standard library time to a protobuf timestamp. ProtoTime panics if the time is invalid.
(stdTime *time.Time)
| 45 | // |
| 46 | // ProtoTime panics if the time is invalid. |
| 47 | func ProtoTime(stdTime *time.Time) *timestamppb.Timestamp { |
| 48 | if stdTime == nil { |
| 49 | return nil |
| 50 | } |
| 51 | return timestamppb.New(*stdTime) |
| 52 | } |