From 3fcd6257ca55f8f3bb712567dca5d3893ff595d3 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 31 Jul 2019 16:24:57 +0800 Subject: [PATCH] update stats format --- common/stats/session/session.go | 3 ++- common/stats/session/utils.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/stats/session/session.go b/common/stats/session/session.go index 305bd59..366eea9 100644 --- a/common/stats/session/session.go +++ b/common/stats/session/session.go @@ -80,7 +80,8 @@ func (s *simpleSessionStater) Start() error { text-align: right; padding: 4; }Go-tun2socks Sessions`) - _, _ = fmt.Fprintf(w, "

Now: %s Uptime: %s

", now(), uptime()) + _, _ = fmt.Fprintf(w, "

%s

", now()) + _, _ = fmt.Fprintf(w, "

Uptime: %s

", uptime()) _, _ = fmt.Fprintf(w, "

Active sessions %d

", len(sessions)) tablePrint(w, sessions) _, _ = fmt.Fprintf(w, "

") diff --git a/common/stats/session/utils.go b/common/stats/session/utils.go index 7effaba..977947f 100644 --- a/common/stats/session/utils.go +++ b/common/stats/session/utils.go @@ -18,6 +18,7 @@ func uptime() string { year, month, day, hour, min, sec := diff(startTime, now) var y, m, d, h string + if year != 0 { y = fmt.Sprintf("%dY", year) }