restore old version of MPI_Wtime(). we're not using it anyway.

This commit is contained in:
Axel Kohlmeyer
2021-10-06 07:09:36 -04:00
parent 81492533e6
commit e3cb5a5e25

View File

@ -17,11 +17,11 @@
#include "../version.h" #include "../version.h"
#include <chrono> #include <stdint.h>
#include <cstdint> #include <stdio.h>
#include <cstdio> #include <stdlib.h>
#include <cstdlib> #include <string.h>
#include <cstring> #include <sys/time.h>
/* data structure for double/int */ /* data structure for double/int */
@ -164,10 +164,23 @@ int MPI_Finalize()
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
static auto initial_time = std::chrono::steady_clock::now();
double MPI_Wtime() double MPI_Wtime()
{ {
return std::chrono::duration<double>(std::chrono::steady_clock::now() - initial_time).count(); #if defined(_MSC_VER)
double t;
t = GetTickCount();
t /= 1000.0;
return t;
#else
double time;
struct timeval tv;
gettimeofday(&tv, NULL);
time = 1.0 * tv.tv_sec + 1.0e-6 * tv.tv_usec;
return time;
#endif
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */