fcm/time.go

23 lines
486 B
Go
Raw Permalink Normal View History

2021-08-09 04:26:03 +00:00
package fcm
import "time"
//
// NOTE: due to unique timezone in server's code, all using time will be convert to HCM timezone (UTC +7)
// All functions generate time, must be call util functions here
// WARNING: don't accept call time.Now() directly
//
const timezoneHCM = "Asia/Ho_Chi_Minh"
2021-08-09 04:43:47 +00:00
// getHCMLocation ...
func getHCMLocation() *time.Location {
2021-08-09 04:26:03 +00:00
l, _ := time.LoadLocation(timezoneHCM)
return l
}
2021-08-09 04:43:47 +00:00
// now ...
func now() time.Time {
return time.Now().In(getHCMLocation())
2021-08-09 04:26:03 +00:00
}