1
0
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:
Deon Thomas 2022-05-10 14:16:03 -04:00
parent 5dd32acc6a
commit e16f1c1cd4
No known key found for this signature in database
GPG Key ID: 0FF7DAE12CA62D67

View File

@ -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
}