From 13d7b3480b0f555294edf2c52a886321bbd9f5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Mur=C3=A9?= Date: Sat, 14 Jul 2018 23:02:49 +0200 Subject: [PATCH] use a Unix timestamp (int64) for the time instead of golang's Time that cause trouble for serialisation --- bug/comment.go | 4 +--- bug/operations/add_comment.go | 4 ++-- bug/operations/create.go | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/bug/comment.go b/bug/comment.go index 2261f6de530cf33589a103e72d1e876db86d5367..09cd49bd10cdc7153da7823656e873e825e9672d 100644 --- a/bug/comment.go +++ b/bug/comment.go @@ -1,12 +1,10 @@ package bug -import "time" - type Comment struct { Author Person Message string // Creation time of the comment. // Should be used only for human display, never for ordering as we can't rely on it in a distributed system. - Time time.Time + Time int64 } diff --git a/bug/operations/add_comment.go b/bug/operations/add_comment.go index 1f9e341016387ab07d6f0d2615db4ad36c042c84..ce33522c155dd63d12e4e0d255cd082876021f13 100644 --- a/bug/operations/add_comment.go +++ b/bug/operations/add_comment.go @@ -11,7 +11,7 @@ type AddCommentOperation struct { bug.OpBase Message string Author bug.Person - Time time.Time + Time int64 } func NewAddCommentOp(author bug.Person, message string) AddCommentOperation { @@ -19,7 +19,7 @@ func NewAddCommentOp(author bug.Person, message string) AddCommentOperation { OpBase: bug.OpBase{OperationType: bug.ADD_COMMENT}, Message: message, Author: author, - Time: time.Now(), + Time: time.Now().Unix(), } } diff --git a/bug/operations/create.go b/bug/operations/create.go index 81fc58f1accaffaf79d23a56c6be4ff91a1371d0..f4ca11ad7cb99d39aba8036ba1d9f81eea38ab88 100644 --- a/bug/operations/create.go +++ b/bug/operations/create.go @@ -15,7 +15,7 @@ type CreateOperation struct { Title string Message string Author bug.Person - Time time.Time + Time int64 } func NewCreateOp(author bug.Person, title, message string) CreateOperation { @@ -24,7 +24,7 @@ func NewCreateOp(author bug.Person, title, message string) CreateOperation { Title: title, Message: message, Author: author, - Time: time.Now(), + Time: time.Now().Unix(), } }