github.com/TeaOSLab/EdgeNode@v1.3.8/internal/utils/time.go (about) 1 package utils 2 3 import ( 4 "time" 5 ) 6 7 // GMTUnixTime 计算GMT时间戳 8 func GMTUnixTime(timestamp int64) int64 { 9 _, offset := time.Now().Zone() 10 return timestamp - int64(offset) 11 } 12 13 // GMTTime 计算GMT时间 14 func GMTTime(t time.Time) time.Time { 15 _, offset := time.Now().Zone() 16 return t.Add(-time.Duration(offset) * time.Second) 17 }