Chromium Code Reviews| Index: common/proto/google/util.go |
| diff --git a/common/proto/google/util.go b/common/proto/google/util.go |
| index 755b2f2609d5609c11d55fb334d6b4163548d89a..d5964ddfa080088c74c3440f69a86be60da0aec7 100644 |
| --- a/common/proto/google/util.go |
| +++ b/common/proto/google/util.go |
| @@ -24,6 +24,12 @@ func NewTimestamp(t time.Time) *Timestamp { |
| } |
| } |
| +// FromTime sets t to the timestamp of the given time.Time value. |
| +func (t *Timestamp) FromTime(other time.Time) { |
|
Vadim Sh.
2016/04/11 16:52:03
what if 'other' is Zero?
other.Unix() returns som
nodir
2016/04/11 22:16:16
Done.
|
| + t.Seconds = other.Unix() |
| + t.Nanos = int32(other.Nanosecond()) |
| +} |
| + |
| // Time returns the time.Time associated with a Timestamp protobuf. |
| func (t *Timestamp) Time() time.Time { |
| if t == nil { |