stratum
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Wolfgang Hottgenroth 2025-02-11 10:06:36 +01:00
parent 101072eabc
commit 38d35c1e79

View File

@ -39,24 +39,31 @@ func Start() {
Variables: make(map[string]variable_t), Variables: make(map[string]variable_t),
} }
label := "rootdisp"
status := "Ok" status := "Ok"
value := 0.0 rootdisp := 0.0
stratum := 0
resp, err := ntp.Query(server.Name) resp, err := ntp.Query(server.Name)
if err != nil { if err != nil {
status = "Error" status = "Error"
} else { } else {
value = resp.RootDispersion.Seconds() * 1000 rootdisp = resp.RootDispersion.Seconds() * 1000
stratum = resp.Stratum()
} }
v := variable_t { message.Variables["rootdisp"] = variable_t {
Label: label, Label: "rootdisp",
Variable: "", Variable: "",
Value: strconv.FormatFloat(value, 'f', 4, 64), Value: strconv.FormatFloat(rootdisp, 'f', 4, 64),
Unit: "ms",
Status: status,
}
message.Variables["stratum"] = variable_t {
Label: "stratum",
Variable: "",
Value: strconv.FormatInt(stratum, 10),
Unit: "ms", Unit: "ms",
Status: status, Status: status,
} }
message.Variables[label] = v
j, err := json.Marshal(message) j, err := json.Marshal(message)