This is an automated email from the ASF dual-hosted git repository.

wongoo pushed a commit to branch 2.0
in repository https://gitbox.apache.org/repos/asf/dubbo-go-hessian2.git


The following commit(s) were added to refs/heads/2.0 by this push:
     new 2976f7b  upgrade go to v1.17 to fix issue #348  for 2.0 branch (#353)
2976f7b is described below

commit 2976f7bbd72e482546f6e00f4a7dd01d94cb11c8
Author: tiltwind(斜风) <[email protected]>
AuthorDate: Fri Feb 24 21:24:47 2023 +0800

    upgrade go to v1.17 to fix issue #348  for 2.0 branch (#353)
    
    * mark array types deprecated (#347)
    
    * mark array types deprected
    
    * mark array types deprecated
    
    * Update README.md
    
    change readme title
    
    * upgrade go to v1.17 to fix issue #348
    
    ---------
    
    Co-authored-by: Xin.Zh <[email protected]>
---
 .github/workflows/github-actions.yml |  2 +-
 README.md                            |  2 +-
 date.go                              |  6 +++---
 date_test.go                         | 16 ++++++++++++++++
 4 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/github-actions.yml 
b/.github/workflows/github-actions.yml
index 132f03e..0e304f5 100644
--- a/.github/workflows/github-actions.yml
+++ b/.github/workflows/github-actions.yml
@@ -19,7 +19,7 @@ jobs:
         os:
           - ubuntu-latest
         go_version:
-          - 1.13
+          - 1.17
         jdk_version:
           - 1.8
     env:
diff --git a/README.md b/README.md
index d1867f2..0323622 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# gohessian
+# dubbo-go-hessian2
 
 [![Build 
Status](https://travis-ci.org/apache/dubbo-go-hessian2.png?branch=master)](https://travis-ci.org/apache/dubbo-go-hessian2)
 
[![codecov](https://codecov.io/gh/apache/dubbo-go-hessian2/branch/master/graph/badge.svg)](https://codecov.io/gh/apache/dubbo-go-hessian2)
diff --git a/date.go b/date.go
index 0b5329a..4fa6b25 100644
--- a/date.go
+++ b/date.go
@@ -42,12 +42,12 @@ func encDateInMs(b []byte, i interface{}) []byte {
                return append(b, BC_NULL)
        }
        b = append(b, BC_DATE)
-       return append(b, PackInt64(vi.UnixNano()/1e6)...)
+       return append(b, PackInt64(vi.UnixMilli())...)
 }
 
-func encDateInMimute(b []byte, v time.Time) []byte {
+func encDateInMinute(b []byte, v time.Time) []byte {
        b = append(b, BC_DATE_MINUTE)
-       return append(b, PackInt32(int32(v.UnixNano()/60e9))...)
+       return append(b, PackInt32(int32(v.Unix()/60))...)
 }
 
 /////////////////////////////////////////
diff --git a/date_test.go b/date_test.go
index f0a8b6f..2954ffc 100644
--- a/date_test.go
+++ b/date_test.go
@@ -66,6 +66,22 @@ func TestEncDate(t *testing.T) {
        d = NewDecoder(e.Buffer())
        res, err = d.Decode()
        t.Logf("decode(%s, %s) = %v, %v\n", v, tz.Local(), res, err)
+       assert.Equal(t, tz.Local(), res)
+}
+
+func TestEncDateIssue348(t *testing.T) {
+       e := NewEncoder()
+       v := "2914-02-09 06:15:23"
+       tz, _ := time.Parse("2006-01-02 15:04:05", v)
+       e.Encode(tz)
+       if len(e.Buffer()) == 0 {
+               t.Fail()
+       }
+
+       d := NewDecoder(e.Buffer())
+       res, err := d.Decode()
+       t.Logf("decode(%s, %s) = %v, %v\n", v, tz.Local(), res, err)
+       assert.Equal(t, tz.Local(), res)
 }
 
 func testDateFramework(t *testing.T, method string, expected time.Time) {

Reply via email to