Hi On Sun, Dec 6, 2020 at 9:46 AM Anatol Pomozov <anatol.pomo...@gmail.com> wrote: > I need to localize this string. Will resend an updated patch for it.
I localized it in the v2 of the patch > > > + > > > +static void update_total_finalstats(void) > > > +{ > > > + int64_t timediff; > > > + > > > + /* compute final values */ > > > + totalbar->xfered = totalbar->total_size; > > > + timediff = get_time_ms() - totalbar->init_time; > > > + > > > + /* if transfer was too fast, treat it as a 1ms transfer, for the > > > sake > > > + * of the rate calculation */ > > > + if(timediff < 1) > > > + timediff = 1; > > > + > > > + totalbar->rate = (double)totalbar->xfered * 1000 / timediff; > > > + /* round elapsed time (in ms) to the nearest second */ > > > + totalbar->eta = (unsigned int)(timediff + 500) / 1000; > > > + > > > + console_cursor_move_end(); > > > + draw_pacman_progress_bar(totalbar); > > > +} > > > > OK. I get the feeling that this and the above function are duplicating > > a bit of code from normal progress bars. But a quick look leads me to > > think it is not worth refactoring. > > These 2 functions (update and finalupdate for total bar) are slightly > different. > But there is some duplication in "update file" and "update total" bar > logic. I can try to refactor and see if it makes things cleaner. I refactored the code and introduced "update stats" and "update final stats" functions that work both for "file progress" and "total progress".