mirror of
https://github.com/juanfont/headscale.git
synced 2025-09-02 13:47:00 +02:00
Added NowFromTZEnv() to get time via timezone
This commit is contained in:
parent
5dd32acc6a
commit
e16f1c1cd4
8
utils.go
8
utils.go
@ -13,8 +13,10 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/viper"
|
||||
"inet.af/netaddr"
|
||||
"tailscale.com/tailcfg"
|
||||
"tailscale.com/types/key"
|
||||
@ -327,3 +329,9 @@ func IsStringInSlice(slice []string, str string) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func NowFromTZEnv() time.Time {
|
||||
location, _ := time.LoadLocation(viper.GetString("TZ"))
|
||||
now := time.Now().In(location)
|
||||
return now
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user