| 24 | } |
| 25 | |
| 26 | void print_progress(double perc) { |
| 27 | static double last_perc = 0; |
| 28 | static time_t last_print_time = 0; |
| 29 | time_t cur_time = time(NULL); |
| 30 | |
| 31 | if (perc - last_perc < 0.01 || cur_time - last_print_time < 60) { |
| 32 | last_perc = perc; |
| 33 | last_print_time = cur_time; |
| 34 | sleep(2); |
| 35 | return; |
| 36 | } |
| 37 | if (last_perc != 0) fprintf(stdout, "\033[A\033[2K\r"); |
| 38 | fprintf(stdout, "%.2f%%...\n", perc); |
| 39 | last_perc = perc; |
| 40 | last_print_time = cur_time; |
| 41 | } |
no outgoing calls
no test coverage detected