commit d18b177e34bf55dc2b99e390dce04ecbea8c3fea
parent 962f4eded6effdc8474928ec02e3ca9e33ed753f
Author: Claudio Alessi <smoppy@gmail.com>
Date: Tue, 26 Sep 2017 19:15:29 +0200
Prevent calling fflush() at each cycle.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/snore.c b/snore.c
@@ -108,6 +108,7 @@ main(int argc, char *argv[]) {
if(argc == 2 && !strcmp("-v", argv[1]))
die("snore-"VERSION"\n");
+ setbuf(stdout, NULL);
for(i = 1; i < argc; ++i) {
tm = time_to_sec(argv[i]);
if(tm < 0)
@@ -122,9 +123,8 @@ main(int argc, char *argv[]) {
time_print(tm); /* ascending */
printf(" | ");
time_print(endtm - tm); /* descending */
- fflush(stdout);
sleepu(TICK);
- printf("%s", CLEAR);
+ printf(CLEAR);
}
printf("\a%s elapsed\n", argv[1]);
return 0;