aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2017-11-27 21:34:10 +1300
committerDavid Phillips <david@sighup.nz>2017-11-27 21:34:10 +1300
commit922a3aedb72c94298441f9b53a9bd8d5b731e5a7 (patch)
treea44def09dc9e9262dcd7535b6363796256b87625
parenta21ef15964b7a242303edb71180ab5f1f45165e5 (diff)
downloadsand-leek-922a3aedb72c94298441f9b53a9bd8d5b731e5a7.tar.xz
Clear status line properly, show "overdue" instead of negative time remaining
-rw-r--r--colour.h3
-rw-r--r--sand-leek.c6
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++;