diff --git a/utils.go b/utils.go index 3dace875..bd53c805 100644 --- a/utils.go +++ b/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 +}