tprint time output on the same line - stopwatch - simple timer for console or x root window
git clone git://src.adamsgaard.dk/stopwatch
Log
Files
Refs
README
LICENSE
---
commit 2a1619b38698fc684593f26ba052a929ed6acca9
parent 726a3f3bb2024aacae76badec62e8cc0142b18f9
Author: Anders Damsgaard 
Date:   Thu,  5 Nov 2020 07:25:40 +0100

print time output on the same line

Diffstat:
  M stopwatch.c                         |       2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/stopwatch.c b/stopwatch.c
t@@ -39,7 +39,7 @@ print_loop(unsigned int interval, char *prefix, char *postfix)
 
         while (1) {
                 format_time(buf, sizeof(buf), time(NULL) - t_start, prefix, postfix);
-                printf("\r%s\n", buf);
+                printf("\r%s", buf);
                 fflush(stdout);
                 sleep(interval);
         }