1 #ifndef CDO_WTIME_H
2 #define CDO_WTIME_H
3 
4 #ifdef _OPENMP
5 //#define CDO_USE_OMP_WTIME
6 #endif
7 
8 #ifdef CDO_USE_OMP_WTIME
9 
10 #ifdef _OPENMP
11 #include <omp.h>  // omp_get_wtime
12 #endif
13 
14 inline double
cdo_get_wtime()15 cdo_get_wtime()
16 {
17 #ifdef _OPENMP
18   return omp_get_wtime();
19 #else
20   return 0;
21 #endif
22 }
23 
24 #else
25 
26 #include <chrono>
27 
28 inline double
cdo_get_wtime()29 cdo_get_wtime()
30 {
31   using namespace std::chrono;
32   return duration_cast<duration<double>>(steady_clock::now().time_since_epoch()).count();
33 }
34 
35 #endif
36 
37 #endif
38