- if(new_time.tv_sec - prev_time.tv_sec >= 1)
- {
- gettimeofday(¤t_time, 0);
- int64_t elapsed_seconds = current_time.tv_sec - start_time.tv_sec;
- int64_t total_seconds = !bytes_processed ? 0 :
- elapsed_seconds * total_bytes / bytes_processed;
- int64_t eta = total_seconds - elapsed_seconds;
- progress->update(bytes_processed, 1);
- char string[BCTEXTLEN];
- sprintf(string, "%sETA: %jdm%jds",
- progress_title, eta / 60, eta % 60);
- progress->update_title(string, 1);
-// fprintf(stderr, "ETA: %dm%ds \r",
-// bytes_processed * 100 / total_bytes,
-// eta / 60, eta % 60);
-// fflush(stdout);
- prev_time = new_time;
- }
- if(bytes_processed >= total_bytes) break;
- if(progress->is_cancelled()) result = 1;
- if( bytes_processed == last_bytes ) {
- eprintf(_("toc scan stopped before eof"));
- break;
- }
- last_bytes = bytes_processed;
- }