void tfc_getcurtime(tfc_useconds *tx)
{
- struct timeval t;
+ struct timespec t;
memset(&t, 0, sizeof(t));
- gettimeofday(&t, NULL);
- *tx = (tfc_useconds)t.tv_sec * 1000000 + t.tv_usec;
+ clock_gettime(CLOCK_MONOTONIC, &t);
+ *tx = (tfc_useconds)t.tv_sec * 1000000 + (t.tv_nsec / 1000);
memset(&t, 0, sizeof(t));
}
minutes = (secs / 60) % 60;
seconds = secs % 60;
- if (days > 0) sprintf(r, "%ud,%02u:%02u:%02u.%03u", days, hours, minutes, seconds, (unsigned)(dsecs / 1000));
- else if (hours > 0) sprintf(r, "%02u:%02u:%02u.%03u", hours, minutes, seconds, (unsigned)(dsecs / 1000));
- else if (minutes > 0) sprintf(r, "%02u:%02u.%03u", minutes, seconds, (unsigned)(dsecs / 1000));
- else sprintf(r, "%02u.%03u", seconds, (unsigned)(dsecs / 1000));
+ if (days > 0) sprintf(r, "%ud,%02u:%02u:%02u.%04u", days, hours, minutes, seconds, (unsigned)(dsecs / 100));
+ else if (hours > 0) sprintf(r, "%02u:%02u:%02u.%04u", hours, minutes, seconds, (unsigned)(dsecs / 100));
+ else if (minutes > 0) sprintf(r, "%02u:%02u.%04u", minutes, seconds, (unsigned)(dsecs / 100));
+ else sprintf(r, "%02u.%04u", seconds, (unsigned)(dsecs / 100));
return r;
}
void handle_sigtstp(int signal)
{
- if (signal == SIGTSTP) kill(getpid(), SIGSTOP);
+ if (signal == SIGTSTP) {
+ tfc_useconds freeze_start, freeze_end;
+
+ tfc_getcurtime(&freeze_start);
+ kill(getpid(), SIGSTOP);
+ tfc_getcurtime(&freeze_end);
+ total_time -= (freeze_end - freeze_start);
+ }
}
void print_crypt_status(int signal)
"avg. speed %llu (%.2f%s) B/s, time %.4fs.",
oper_mode,
total_processed_src, human_totalproc_src, tfc_getscale(src_scale_idx),
- wr_speed, human_wr_speed, tfc_getscale(wr_speed_scale),
- TFC_UTODSECS(current_time - delta_time));
+ wr_speed, human_wr_speed, tfc_getscale(wr_speed_scale), seconds);
tfc_esay("\n");
xexit(0);
}