Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Unified Diff: service/datastore/serialize/serialize.go

Issue 1345043005: Fix zero time bug (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/datastore/properties.go ('k') | service/datastore/serialize/serialize_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/serialize/serialize.go
diff --git a/service/datastore/serialize/serialize.go b/service/datastore/serialize/serialize.go
index 0c58fcae712ce249acf633e5d0b7d089c7d8a415..baea9b328207cebe69a55f879ce7b0e97c41e71c 100644
--- a/service/datastore/serialize/serialize.go
+++ b/service/datastore/serialize/serialize.go
@@ -207,7 +207,11 @@ func ReadTime(buf Buffer) (time.Time, error) {
if err != nil {
return time.Time{}, err
}
- return time.Unix(v/1e6, (v%1e6)*1e3).UTC(), nil
+ t := time.Unix(v/1e6, (v%1e6)*1e3)
+ if t.IsZero() {
+ return time.Time{}, nil
+ }
+ return t.UTC(), nil
}
// WriteProperty writes a Property to the buffer. `context` behaves the same
« no previous file with comments | « service/datastore/properties.go ('k') | service/datastore/serialize/serialize_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698