StdTime converts a protobuf timestamp to a standard library time. ProtoTime panics if the time is invalid.
(protoTime *timestamppb.Timestamp)
| 24 | // |
| 25 | // ProtoTime panics if the time is invalid. |
| 26 | func StdTime(protoTime *timestamppb.Timestamp) *time.Time { |
| 27 | if protoTime == nil { |
| 28 | return nil |
| 29 | } |
| 30 | stdTime := protoTime.AsTime() |
| 31 | return &stdTime |
| 32 | } |
| 33 | |
| 34 | // StdTimeOrZero converts a protobuf time to a standard library time. |
| 35 | // If protoTime is nil, it returns a zero time. |
no outgoing calls