Fix batch mode for tools progress function.

This commit is contained in:
Milan Broz
2017-06-08 15:05:28 +02:00
parent 73030aa5fb
commit edba04c978
2 changed files with 4 additions and 2 deletions

View File

@@ -137,7 +137,6 @@ static int wipe_callback(uint64_t size, uint64_t offset, void *usrptr)
static struct timeval start_time = {}, end_time = {}; static struct timeval start_time = {}, end_time = {};
int r = 0; int r = 0;
if (!opt_batch_mode)
tools_time_progress(size, offset, &start_time, &end_time); tools_time_progress(size, offset, &start_time, &end_time);
check_signal(&r); check_signal(&r);

View File

@@ -351,6 +351,9 @@ void tools_time_progress(uint64_t device_size, uint64_t bytes,
double tdiff, mib; double tdiff, mib;
int final = (bytes == device_size); int final = (bytes == device_size);
if (opt_batch_mode)
return;
gettimeofday(&now_time, NULL); gettimeofday(&now_time, NULL);
if (start_time->tv_sec == 0 && start_time->tv_usec == 0) { if (start_time->tv_sec == 0 && start_time->tv_usec == 0) {
*start_time = now_time; *start_time = now_time;