aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/golang/protobuf/ptypes/timestamp.go
diff options
context:
space:
mode:
authorNathan Dench <ndenc2@gmail.com>2019-05-24 15:16:44 +1000
committerNathan Dench <ndenc2@gmail.com>2019-05-24 15:16:44 +1000
commit107c1cdb09c575aa2f61d97f48d8587eb6bada4c (patch)
treeca7d008643efc555c388baeaf1d986e0b6b3e28c /vendor/github.com/golang/protobuf/ptypes/timestamp.go
parent844b5a68d8af4791755b8f0ad293cc99f5959183 (diff)
downloadterraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.gz
terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.tar.zst
terraform-provider-statuscake-107c1cdb09c575aa2f61d97f48d8587eb6bada4c.zip
Upgrade to 0.12
Diffstat (limited to 'vendor/github.com/golang/protobuf/ptypes/timestamp.go')
-rw-r--r--vendor/github.com/golang/protobuf/ptypes/timestamp.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/vendor/github.com/golang/protobuf/ptypes/timestamp.go
index 47f10db..8da0df0 100644
--- a/vendor/github.com/golang/protobuf/ptypes/timestamp.go
+++ b/vendor/github.com/golang/protobuf/ptypes/timestamp.go
@@ -111,11 +111,9 @@ func TimestampNow() *tspb.Timestamp {
111// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. 111// TimestampProto converts the time.Time to a google.protobuf.Timestamp proto.
112// It returns an error if the resulting Timestamp is invalid. 112// It returns an error if the resulting Timestamp is invalid.
113func TimestampProto(t time.Time) (*tspb.Timestamp, error) { 113func TimestampProto(t time.Time) (*tspb.Timestamp, error) {
114 seconds := t.Unix()
115 nanos := int32(t.Sub(time.Unix(seconds, 0)))
116 ts := &tspb.Timestamp{ 114 ts := &tspb.Timestamp{
117 Seconds: seconds, 115 Seconds: t.Unix(),
118 Nanos: nanos, 116 Nanos: int32(t.Nanosecond()),
119 } 117 }
120 if err := validateTimestamp(ts); err != nil { 118 if err := validateTimestamp(ts); err != nil {
121 return nil, err 119 return nil, err