misunderstand

This commit is contained in:
Bel LaPointe
2026-06-08 12:50:07 -07:00
parent 08245c1ba9
commit 8e202a0381
2 changed files with 7 additions and 7 deletions

14
main.go
View File

@@ -46,19 +46,19 @@ func run() error {
fmt.Printf("%s,%d,%.0f%%,%dms,%dms,%dms\n", fmt.Printf("%s,%d,%.0f%%,%dms,%dms,%dms\n",
time.Now().UTC().Format("2006-01-02T15:04:05Z"), time.Now().UTC().Format("2006-01-02T15:04:05Z"),
stat.PacketsRecv, stat.PacketsRecv,
100.0*(1.0-stat.PacketLoss), stat.PacketLoss,
stat.MaxRtt.Milliseconds(), stat.MaxRtt.Milliseconds(),
stat.AvgRtt.Milliseconds(), stat.AvgRtt.Milliseconds(),
stat.StdDevRtt.Milliseconds(), stat.StdDevRtt.Milliseconds(),
) )
case "json": case "json":
b, _ := json.Marshal(map[string]any{ b, _ := json.Marshal(map[string]any{
"ts": time.Now().UTC().Format("2006-01-02T15:04:05Z"), "ts": time.Now().UTC().Format("2006-01-02T15:04:05Z"),
"n": stat.PacketsRecv, "n": stat.PacketsRecv,
"ok_pct": 100.0 * (1.0 - stat.PacketLoss), "bad_pct": stat.PacketLoss,
"max": stat.MaxRtt.Milliseconds(), "max": stat.MaxRtt.Milliseconds(),
"avg": stat.AvgRtt.Milliseconds(), "avg": stat.AvgRtt.Milliseconds(),
"stddev": stat.StdDevRtt.Milliseconds(), "stddev": stat.StdDevRtt.Milliseconds(),
}) })
fmt.Printf("%s\n", b) fmt.Printf("%s\n", b)
} }

BIN
pingd Executable file

Binary file not shown.