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

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

Issue 1334043003: Use int64 to store time.Time internally in memory implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: remove debug panic 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 | « impl/memory/datastore_test.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 9b7d7c7100091267ee3660f7f48c9e152d78c47a..88c887fc281cd8acd328b59337f909529e71b5c4 100644
--- a/service/datastore/serialize/serialize.go
+++ b/service/datastore/serialize/serialize.go
@@ -198,17 +198,17 @@ func WriteTime(buf Buffer, t time.Time) error {
if name != "UTC" || off != 0 {
panic(fmt.Errorf("helper: UTC OR DEATH: %s", t))
}
- _, err := cmpbin.WriteUint(buf, uint64(t.Unix())*1e6+uint64(t.Nanosecond()/1e3))
+ _, err := cmpbin.WriteInt(buf, t.Unix()*1e6+int64(t.Nanosecond()/1e3))
return err
}
// ReadTime reads a time.Time from the buffer.
func ReadTime(buf Buffer) (time.Time, error) {
- v, _, err := cmpbin.ReadUint(buf)
+ v, _, err := cmpbin.ReadInt(buf)
if err != nil {
return time.Time{}, err
}
- return time.Unix(int64(v/1e6), int64((v%1e6)*1e3)).UTC(), nil
+ return time.Unix(v/1e6, (v%1e6)*1e3).UTC(), nil
}
// WriteProperty writes a Property to the buffer. `context` behaves the same
« no previous file with comments | « impl/memory/datastore_test.go ('k') | service/datastore/serialize/serialize_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698