+static void
+upgrade_print_progress (void *closure,
+ unsigned int count,
+ unsigned int total)
+{
+ add_files_state_t *state = closure;
+ struct timeval tv_now;
+ double elapsed_overall, rate_overall, time_remaining;
+
+ gettimeofday (&tv_now, NULL);
+
+ elapsed_overall = notmuch_time_elapsed (state->tv_start, tv_now);
+ rate_overall = count / elapsed_overall;
+ time_remaining = ((total - count) / rate_overall);
+
+ printf ("Upgraded %d of %d messages (", count, total);
+ notmuch_time_print_formatted_seconds (time_remaining);
+ printf (" remaining). \r");
+
+ fflush (stdout);
+}
+