Skip to content

Commit

Permalink
use C++11 chrono instead of POSIX clock() (#41)
Browse files Browse the repository at this point in the history
* use C++11 instead of POSIX clock()
  • Loading branch information
jeffhammond authored Jul 3, 2020
1 parent 9ddf426 commit 320d271
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/utilsMpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,16 @@ void mpiGather(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbu
}
}

#include <chrono>

double mpiWtime (void)
{
double value;
value = ( double ) clock ( ) / ( double ) CLOCKS_PER_SEC;
return value;
using t = std::chrono::high_resolution_clock;
auto c = t::now().time_since_epoch().count();
auto n = t::period::num;
auto d = t::period::den;
double r = static_cast<double>(c)/static_cast<double>(d)*static_cast<double>(n);
return r;
}

static Handleitem *init_block(int block, Handleitem *b)
Expand Down

0 comments on commit 320d271

Please sign in to comment.