|
|
@@ -111,11 +111,9 @@ func TimestampNow() *tspb.Timestamp {
|
|
|
// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.
|
|
|
// It returns an error if the resulting Timestamp is invalid.
|
|
|
func TimestampProto(t time.Time) (*tspb.Timestamp, error) {
|
|
|
- seconds := t.Unix()
|
|
|
- nanos := int32(t.Sub(time.Unix(seconds, 0)))
|
|
|
ts := &tspb.Timestamp{
|
|
|
- Seconds: seconds,
|
|
|
- Nanos: nanos,
|
|
|
+ Seconds: t.Unix(),
|
|
|
+ Nanos: int32(t.Nanosecond()),
|
|
|
}
|
|
|
if err := validateTimestamp(ts); err != nil {
|
|
|
return nil, err
|