From 922a3aedb72c94298441f9b53a9bd8d5b731e5a7 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Mon, 27 Nov 2017 21:34:10 +1300 Subject: Clear status line properly, show "overdue" instead of negative time remaining --- colour.h | 3 ++- sand-leek.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/colour.h b/colour.h index 82d41e4..2fe75c2 100644 --- a/colour.h +++ b/colour.h @@ -24,7 +24,8 @@ #define COLOUR_BOLD_OFF ANSI_ESC"22m" #define COLOUR_OFF ANSI_ESC"39m" - #define COLOUR_ALL_OFF ANSI_ESC"0m" +#define COLOUR_ERASE ANSI_ESC"2K" + #endif diff --git a/sand-leek.c b/sand-leek.c index d53e524..edf64f1 100644 --- a/sand-leek.c +++ b/sand-leek.c @@ -334,12 +334,14 @@ monitor_progress(unsigned long volatile *khashes, int thread_count) { remaining_unit = "year"; } - iprintf("[%02d:%02d:%02d:%02d]: %.2f %s hashes%s. Now ~%lu kH/s (%.2f kH/s/thread). Maybe %ld %s%s left \r", + iprintf_bare(COLOUR_ERASE); + iprintf("[%02d:%02d:%02d:%02d]: %.2f %s hashes%s. Now ~%lu kH/s (%.2f kH/s/thread). Maybe %ld %s%s %s\r", days, hours, minutes, seconds, hashes_nice, hashes_nice_unit, (hashes_nice > 1000 ? " (!!)" : ""), total_khashes - last_total_khashes, (double)(total_khashes - last_total_khashes) / thread_count, - remaining, remaining_unit, (remaining == 1 ? "" : "s" ) + labs(remaining), remaining_unit, (labs(remaining) == 1 ? "" : "s" ), + (remaining < 0 ? "overdue" : "left") ); sleep(1); loops++; -- cgit v1.1