From 45b873f462bf0d7fb314d717e16a208c1c297226 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Mon, 27 Mar 2023 06:51:15 -0600 Subject: [PATCH] test status --- src/device/input/parse/v01/server.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/device/input/parse/v01/server.go b/src/device/input/parse/v01/server.go index 5be5404..05b9371 100644 --- a/src/device/input/parse/v01/server.go +++ b/src/device/input/parse/v01/server.go @@ -182,13 +182,16 @@ func (v01 *V01) serveGMStatus(w http.ResponseWriter, r *http.Request) { log.Printf("status with %+v", v01.cfg) users := map[string]interface{}{} for k, v := range v01.cfg.Users { - v2 := map[string]interface{}{ - "Last Activity": time.Since(time.Unix(0, v.LastTSMS/int64(time.Millisecond))), - "Lag": time.Duration(v.LastLag) / time.Millisecond, + v2 := map[string]interface{}{} + if v.LastLag > 0 { + v2["Lag"] = time.Duration(v.LastLag) / time.Millisecond } if v.Player > 0 { v2["Player"] = v.Player } + if v.LastTSMS > 0 { + v2["Last Activity"] = time.Since(time.Unix(0, v.LastTSMS/int64(time.Millisecond))) + } users[k] = v2 } yaml.NewEncoder(w).Encode(map[string]interface{}{