print remaining walltime with 1/100th of a second resolution

This commit is contained in:
Axel Kohlmeyer
2015-10-25 10:52:34 -04:00
parent 18bd33924c
commit 43b64d276e

View File

@ -229,10 +229,12 @@ void Timer::print_timeout(FILE *fp)
// format timeout setting
if (_timeout > 0) {
char timebuf[32];
time_t tv = _timeout - (MPI_Wtime() - timeout_start);
struct tm *tm = gmtime(&tv);
double delta = MPI_Wtime() - timeout_start;
time_t sec = _timeout - delta;
int hsec = 100*((_timeout - delta) - tv);
struct tm *tm = gmtime(&sec);
strftime(timebuf,32,"%H:%M:%S",tm);
fprintf(fp," Walltime left: %s\n",timebuf);
fprintf(fp," Walltime left: %s.%02d\n",timebuf,hsec);
}
}