|
15 | 15 | /* |
16 | 16 | * Show updates to the percentage and number of objects received |
17 | 17 | * separately from the throughput to give an accurate progress while |
18 | | - * avoiding too much noise on the screen. |
| 18 | + * avoiding too much noise on the screen. (In milliseconds.) |
19 | 19 | */ |
20 | | -#define PROGRESS_UPDATE_TIME 0.10 |
21 | | -#define THROUGHPUT_UPDATE_TIME 1.00 |
| 20 | +#define PROGRESS_UPDATE_TIME 60 |
| 21 | +#define THROUGHPUT_UPDATE_TIME 500 |
22 | 22 |
|
23 | 23 | #define is_nl(c) ((c) == '\r' || (c) == '\n') |
24 | 24 |
|
@@ -54,7 +54,7 @@ static int progress_write(cli_progress *progress, bool force, git_str *line) |
54 | 54 | bool has_nl; |
55 | 55 | size_t no_nl = no_nl_len(line->ptr, line->size); |
56 | 56 | size_t nl = nl_len(&has_nl, line->ptr + no_nl, line->size - no_nl); |
57 | | - double now = git__timer(); |
| 57 | + uint64_t now = git_time_monotonic(); |
58 | 58 | size_t i; |
59 | 59 |
|
60 | 60 | /* Avoid spamming the console with progress updates */ |
@@ -191,20 +191,21 @@ static int fetch_receiving( |
191 | 191 | { |
192 | 192 | char *recv_units[] = { "B", "KiB", "MiB", "GiB", "TiB", NULL }; |
193 | 193 | char *rate_units[] = { "B/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s", NULL }; |
| 194 | + uint64_t now, elapsed; |
194 | 195 |
|
195 | | - double now, recv_len, rate, elapsed; |
| 196 | + double recv_len, rate; |
196 | 197 | size_t recv_unit_idx = 0, rate_unit_idx = 0; |
197 | 198 | bool done = (stats->received_objects == stats->total_objects); |
198 | 199 |
|
199 | 200 | if (!progress->action_start) |
200 | | - progress->action_start = git__timer(); |
| 201 | + progress->action_start = git_time_monotonic(); |
201 | 202 |
|
202 | 203 | if (done && progress->action_finish) |
203 | 204 | now = progress->action_finish; |
204 | 205 | else if (done) |
205 | | - progress->action_finish = now = git__timer(); |
| 206 | + progress->action_finish = now = git_time_monotonic(); |
206 | 207 | else |
207 | | - now = git__timer(); |
| 208 | + now = git_time_monotonic(); |
208 | 209 |
|
209 | 210 | if (progress->throughput_update && |
210 | 211 | now - progress->throughput_update < THROUGHPUT_UPDATE_TIME) { |
|
0 commit comments