From 7a4264fe1e45120c4a3362b0dfd1994c952fd11c Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sun, 22 Dec 2024 00:42:01 +0000 Subject: [PATCH] Do not show negative timer values. --- src/pv/format/timer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pv/format/timer.c b/src/pv/format/timer.c index 3297d09..5f599c6 100644 --- a/src/pv/format/timer.c +++ b/src/pv/format/timer.c @@ -33,6 +33,10 @@ pvdisplay_bytecount_t pv_formatter_timer(pvformatter_args_t args) if (args->state->transfer.elapsed_seconds > (long double) 360000000.0L) args->state->transfer.elapsed_seconds = (long double) 360000000.0L; + /* Also check it's not negative. */ + if (args->state->transfer.elapsed_seconds < 0.0) + args->state->transfer.elapsed_seconds = 0.0; + /* * If the elapsed time is more than a day, include a day count as * well as hours, minutes, and seconds.