|
@@ -5,8 +5,23 @@ import (
|
|
|
"math"
|
|
"math"
|
|
|
"testing"
|
|
"testing"
|
|
|
"time"
|
|
"time"
|
|
|
|
|
+
|
|
|
|
|
+ "github.com/stretchr/testify/assert"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+func TestUTC(t *testing.T) {
|
|
|
|
|
+ tm, _ := time.ParseInLocation("2006-01-02 15:04:05.000000000", "1970-01-01 00:00:00.000000000", time.UTC)
|
|
|
|
|
+ fmt.Println(tm.Format("2006-01-02 15:04:05.000000000-07:00"), "=>", tm.UnixNano())
|
|
|
|
|
+ if !assert.Equal(t, tm.UnixNano(), int64(0)) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ tm, _ = time.ParseInLocation("2006-01-02 15:04:05.000000000", "1970-01-01 08:00:00.000000000", time.Local)
|
|
|
|
|
+ fmt.Println(tm.Format("2006-01-02 15:04:05.000000000-07:00"), "=>", tm.UnixNano())
|
|
|
|
|
+ if !assert.Equal(t, tm.UnixNano(), int64(0)) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func TestRound(tx *testing.T) {
|
|
func TestRound(tx *testing.T) {
|
|
|
t, _ := time.Parse("2006-01-02 15:04:05.000000000", "2006-01-02 15:04:05.123456789")
|
|
t, _ := time.Parse("2006-01-02 15:04:05.000000000", "2006-01-02 15:04:05.123456789")
|
|
|
fmt.Println(t.Format("2006-01-02 15:04:05.000000000"))
|
|
fmt.Println(t.Format("2006-01-02 15:04:05.000000000"))
|