github.com/artisanhe/tools@v1.0.1-0.20210607022958-19a8fef2eb04/timelib/utils.go (about)

     1  package timelib
     2  
     3  import (
     4  	"time"
     5  )
     6  
     7  const (
     8  	CST_ZONE_OFFSET = 8 * 60 * 60
     9  )
    10  
    11  func Now() time.Time {
    12  	return time.Now().In(CST)
    13  }
    14  
    15  var (
    16  	UTC *time.Location
    17  	CST *time.Location
    18  )
    19  
    20  const (
    21  	DATE_LAYOUT_S1 = "2006-01-02"
    22  	TIME_LAYOUT_S1 = "2006-01-02 15:04:05"
    23  )
    24  
    25  func init() {
    26  	UTC = time.UTC
    27  	CST = time.FixedZone("CST", CST_ZONE_OFFSET)
    28  }