From 0f9b06b26618528956ac2343359e0ac0e49f1df0 Mon Sep 17 00:00:00 2001 From: Trek H Date: Thu, 11 Feb 2021 09:58:05 +1030 Subject: [PATCH 1/3] revid: only set local clock if it hasn't already been set --- revid/senders.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index 619e08b9..8bf10ea0 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -136,13 +136,16 @@ func extractMeta(r string, log func(lvl int8, msg string, args ...interface{})) if err != nil { return nil } - // Extract time from reply - t, err := dec.Int("ts") - if err != nil { - log(logger.Warning, "No timestamp in reply") - } else { - log(logger.Debug, fmt.Sprintf("got timestamp: %v", t)) - mts.RealTime.Set(time.Unix(int64(t), 0)) + // Extract time from reply if mts.Realtime has not been set. + if !mts.RealTime.IsSet() { + t, err := dec.Int("ts") + if err != nil { + log(logger.Warning, "No timestamp in reply") + } else { + log(logger.Debug, fmt.Sprintf("got timestamp: %v", t)) + fmt.Printf("got timestamp: %v, setting\n", t) + mts.RealTime.Set(time.Unix(int64(t), 0)) + } } // Extract location from reply From 26bb49891767379ede696f84b3a1d2777635e943 Mon Sep 17 00:00:00 2001 From: Trek H Date: Thu, 11 Feb 2021 13:35:11 +1030 Subject: [PATCH 2/3] revid: remove print statement --- revid/senders.go | 1 - 1 file changed, 1 deletion(-) diff --git a/revid/senders.go b/revid/senders.go index 8bf10ea0..cdcb4a77 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -143,7 +143,6 @@ func extractMeta(r string, log func(lvl int8, msg string, args ...interface{})) log(logger.Warning, "No timestamp in reply") } else { log(logger.Debug, fmt.Sprintf("got timestamp: %v", t)) - fmt.Printf("got timestamp: %v, setting\n", t) mts.RealTime.Set(time.Unix(int64(t), 0)) } } From 86c9e4d0a96c603dd84be83f0d01413dea42f6d4 Mon Sep 17 00:00:00 2001 From: Trek H Date: Mon, 15 Feb 2021 10:52:19 +1030 Subject: [PATCH 3/3] revid: improve logging --- revid/senders.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/revid/senders.go b/revid/senders.go index cdcb4a77..11420d72 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -142,7 +142,7 @@ func extractMeta(r string, log func(lvl int8, msg string, args ...interface{})) if err != nil { log(logger.Warning, "No timestamp in reply") } else { - log(logger.Debug, fmt.Sprintf("got timestamp: %v", t)) + log(logger.Debug, "got timestamp", "ts", t) mts.RealTime.Set(time.Unix(int64(t), 0)) } }