diff --git a/util.go b/util.go index 7ec8abf6..09c7742b 100644 --- a/util.go +++ b/util.go @@ -131,7 +131,7 @@ func encodeMsgPack(in interface{}) (*bytes.Buffer, error) { buf := bytes.NewBuffer(nil) hd := codec.MsgpackHandle{ BasicHandle: codec.BasicHandle{ - TimeNotBuiltin: false, + TimeNotBuiltin: true, }, } enc := codec.NewEncoder(buf, &hd) diff --git a/util_test.go b/util_test.go index 8ca0b657..9e3959fd 100644 --- a/util_test.go +++ b/util_test.go @@ -13,7 +13,8 @@ import ( // TestMsgpackEncodeTime ensures that we don't break backwards compatibility when updating go-msgpack with // Raft binary formats. func TestMsgpackEncodeTimeDefaultFormat(t *testing.T) { - tm, err := time.Parse(time.DateTime, time.DateTime) + stamp := "2006-01-02T15:04:05Z" + tm, err := time.Parse(time.RFC3339, stamp) if err != nil { t.Fatal(err) } @@ -22,7 +23,7 @@ func TestMsgpackEncodeTimeDefaultFormat(t *testing.T) { expected := []byte{175, 1, 0, 0, 0, 14, 187, 75, 55, 229, 0, 0, 0, 0, 255, 255} if !bytes.Equal(buf.Bytes(), expected) { - t.Errorf("Expected time %s to encode as %+v but got %+v", time.DateTime, expected, buf.Bytes()) + t.Errorf("Expected time %s to encode as %+v but got %+v", stamp, expected, buf.Bytes()) } }