mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-28 10:51:44 +01:00 
			
		
		
		
	use TimeFromTZEnv to get LastSeen time
This commit is contained in:
		
							parent
							
								
									7fc04e283d
								
							
						
					
					
						commit
						47f7f9884b
					
				@ -12,7 +12,6 @@ import (
 | 
				
			|||||||
	v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
 | 
						v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
 | 
				
			||||||
	"github.com/pterm/pterm"
 | 
						"github.com/pterm/pterm"
 | 
				
			||||||
	"github.com/spf13/cobra"
 | 
						"github.com/spf13/cobra"
 | 
				
			||||||
	"github.com/spf13/viper"
 | 
					 | 
				
			||||||
	"google.golang.org/grpc/status"
 | 
						"google.golang.org/grpc/status"
 | 
				
			||||||
	"inet.af/netaddr"
 | 
						"inet.af/netaddr"
 | 
				
			||||||
	"tailscale.com/types/key"
 | 
						"tailscale.com/types/key"
 | 
				
			||||||
@ -414,8 +413,7 @@ func nodesToPtables(
 | 
				
			|||||||
		var lastSeen time.Time
 | 
							var lastSeen time.Time
 | 
				
			||||||
		var lastSeenTime string
 | 
							var lastSeenTime string
 | 
				
			||||||
		if machine.LastSeen != nil {
 | 
							if machine.LastSeen != nil {
 | 
				
			||||||
			location, _ := time.LoadLocation(viper.GetString("TZ"))
 | 
								lastSeen = headscale.TimeFromTZEnv(machine.LastSeen.AsTime())
 | 
				
			||||||
			lastSeen = machine.LastSeen.AsTime().In(location)
 | 
					 | 
				
			||||||
			lastSeenTime = lastSeen.Format("2006-01-02 15:04:05")
 | 
								lastSeenTime = lastSeen.Format("2006-01-02 15:04:05")
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user