diff options
author | David Phillips <david@sighup.nz> | 2017-11-27 21:34:10 +1300 |
---|---|---|
committer | David Phillips <david@sighup.nz> | 2017-11-27 21:34:10 +1300 |
commit | 922a3aedb72c94298441f9b53a9bd8d5b731e5a7 (patch) | |
tree | a44def09dc9e9262dcd7535b6363796256b87625 | |
parent | a21ef15964b7a242303edb71180ab5f1f45165e5 (diff) | |
download | sand-leek-922a3aedb72c94298441f9b53a9bd8d5b731e5a7.tar.xz |
Clear status line properly, show "overdue" instead of negative time remaining
-rw-r--r-- | colour.h | 3 | ||||
-rw-r--r-- | sand-leek.c | 6 |
2 files changed, 6 insertions, 3 deletions
@@ -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++; |