provide alternative to gettimeofday() for MSVC compilation

This commit is contained in:
Axel Kohlmeyer 2019-05-29 20:13:26 -04:00
parent a48f1cbf00
commit 8dcd6fc48c
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
2 changed files with 16 additions and 0 deletions

View File

@ -148,12 +148,20 @@ int MPI_Finalize()
double MPI_Wtime()
{
#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
}
/* ---------------------------------------------------------------------- */

View File

@ -34,8 +34,16 @@ double t_end;
double Get_Time( )
{
#if defined(_MSC_VER)
double t;
t = GetTickCount();
t /= 1000.0;
return t;
#else
gettimeofday(&tim, NULL );
return( tim.tv_sec + (tim.tv_usec / 1000000.0) );
#endif
}
int Tokenize( char* s, char*** tok )