From 7b59bc8d121a6ed71764f0ef3afed51a8a5ab54e Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 8 Feb 2023 01:37:49 +0100 Subject: [PATCH] avoid division by zero if host fs hyperload is used which loads instantly --- examples/cx16/diskspeed.p8 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/cx16/diskspeed.p8 b/examples/cx16/diskspeed.p8 index 2bdefcb34..c5d8a2657 100644 --- a/examples/cx16/diskspeed.p8 +++ b/examples/cx16/diskspeed.p8 @@ -10,6 +10,10 @@ main { const ubyte REPEATS = 2 sub print_speed(uword jiffies) { + if jiffies==0 { + txt.print("\n 0 jiffies measured, speed is extremely high\n") + return + } float speed = 65536.0 * REPEATS / (jiffies as float / 60.0) txt.nl() txt.print_uw(jiffies)