From efa64eec1444ccb2829bef717fcfbc856542fa17 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 18 Mar 2015 21:28:17 -0400 Subject: [PATCH] Avoid spurious division-by-zero --- echo-client.rkt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/echo-client.rkt b/echo-client.rkt index 319a44e..dbc06ca 100644 --- a/echo-client.rkt +++ b/echo-client.rkt @@ -113,7 +113,9 @@ (loop (+ count 1)) (when record-results? (let* ((elapsed-sec (/ (- now start-time) 1000.0)) - (roundtrip-latency (/ elapsed-sec count))) + (roundtrip-latency (if (zero? count) + elapsed-sec + (/ elapsed-sec count)))) (write-logbook-datum! Tping (list (connection-count) roundtrip-latency (/ 1.0 roundtrip-latency)