From 6f82de48668abd1ccd9c0a6327881758554e6767 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Tue, 7 Jan 2020 00:18:48 +0100 Subject: [PATCH] Auto-set current time for updates --- handler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/handler.go b/handler.go index 0e352cd..c0b11ec 100644 --- a/handler.go +++ b/handler.go @@ -16,6 +16,7 @@ type position struct { Lat float64 `json:"lat"` Lon float64 `json:"lon"` Retained bool `json:"retained"` + SenderID string `json:"sender_id"` Time time.Time `json:"time"` } @@ -100,6 +101,8 @@ func handleMapSubmit(w http.ResponseWriter, r *http.Request) { return } + pos.Time = time.Now() + if pos.Retained { reqRetainerLock.Lock() reqRetainer[mapID] = pos