github.com/GuanceCloud/cliutils@v1.1.21/pipeline/ptinput/funcs/handle_test.go (about) 1 // Unless explicitly stated otherwise all files in this repository are licensed 2 // under the MIT License. 3 // This product includes software developed at Guance Cloud (https://www.guance.com/). 4 // Copyright 2021-present Guance, Inc. 5 6 package funcs 7 8 import ( 9 "fmt" 10 T "testing" 11 "time" 12 13 "github.com/stretchr/testify/assert" 14 ) 15 16 func TestTimestampHandle(t *T.T) { 17 t.Run("test-tz+0", func(t *T.T) { 18 for i := 1970; i < 1980; i++ { 19 x := fmt.Sprintf("Thu Jan 16 10:05:19 %d", i) 20 ts, err := TimestampHandle(x, "+0") 21 22 assert.NoError(t, err) 23 24 t.Logf("%s : %v", x, time.Unix(0, ts)) 25 } 26 }) 27 }