]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/golang/protobuf/ptypes/timestamp.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / golang / protobuf / ptypes / timestamp.go
index 47f10dbc2cccefcac7dfe0bcc83d272960fbb182..8da0df01acd17e41c86ca441fc56529178505d8c 100644 (file)
@@ -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