Author: Paolo Lulli <paolo@lulli.net>
write on empty dates
server/rest/rest-event.go | 4 ++-- server/rest/rest-metric.go | 2 +-
diff --git a/server/rest/rest-event.go b/server/rest/rest-event.go index b29c0ac9b2f1e573580c98f8824f11a3f0bf4ee3..778ab16a5866ccc1d2f8b66e96c9aa9ca23959c7 100644 --- a/server/rest/rest-event.go +++ b/server/rest/rest-event.go @@ -30,10 +30,10 @@ clientCN := GetClientCN(c) fmt.Printf("%s / %s ", clientCN, event.Name) if event.Etime == 0 { + db.SaveEvent(clientCN, event.Name) + } else { unixTimeUTC := time.Unix(event.Etime, 0) db.SaveEventAt(clientCN, unixTimeUTC, event.Name) - } else { - db.SaveEvent(clientCN, event.Name) } c.IndentedJSON(http.StatusAccepted, gin.H{"ret": "OK"}) } diff --git a/server/rest/rest-metric.go b/server/rest/rest-metric.go index a178f98b0b7c7554f8cfcb96adb1d9790b735056..bcca202a3982591b39955b625da6142d9b14bb44 100644 --- a/server/rest/rest-metric.go +++ b/server/rest/rest-metric.go @@ -30,7 +30,7 @@ clientCN := GetClientCN(c) fmt.Printf("%s / %s / %s", clientCN, metric.Name, metric.Value) - if metric.Mtime == 0 { + if metric.Mtime != 0 { unixTimeUTC := time.Unix(metric.Mtime, 0) db.SaveMetricAt(clientCN, unixTimeUTC, metric.Name, metric.Value) } else {