1
0
mirror of https://github.com/juanfont/headscale.git synced 2025-09-02 13:47:00 +02:00

use TimeFromTZEnv to get LastSeen time

This commit is contained in:
Deon Thomas 2022-05-10 14:40:44 -04:00
parent 7fc04e283d
commit 47f7f9884b
No known key found for this signature in database
GPG Key ID: 0FF7DAE12CA62D67

View File

@ -12,7 +12,6 @@ import (
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
"github.com/pterm/pterm"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"google.golang.org/grpc/status"
"inet.af/netaddr"
"tailscale.com/types/key"
@ -414,8 +413,7 @@ func nodesToPtables(
var lastSeen time.Time
var lastSeenTime string
if machine.LastSeen != nil {
location, _ := time.LoadLocation(viper.GetString("TZ"))
lastSeen = machine.LastSeen.AsTime().In(location)
lastSeen = headscale.TimeFromTZEnv(machine.LastSeen.AsTime())
lastSeenTime = lastSeen.Format("2006-01-02 15:04:05")
}