File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change 2424
2525#include "opal/class/opal_pointer_array.h"
2626#include "opal/class/opal_hash_table.h"
27+ #include "opal/util/clock_gettime.h"
2728
2829static opal_pointer_array_t registered_sources ;
2930static bool mca_base_source_initialized = false;
@@ -36,29 +37,23 @@ int mca_base_source_default_source = -1;
3637static uint64_t mca_base_source_default_time_source (void )
3738{
3839 uint64_t time_value ;
39-
40- #if OPAL_HAVE_CLOCK_GETTIME
4140 struct timespec current ;
4241
43- clock_gettime ( CLOCK_MONOTONIC , & current );
42+ ( void ) opal_clock_gettime ( & current );
4443 time_value = 1000000000ul * current .tv_sec + current .tv_nsec ;
45- #else
46- struct timeval current ;
47-
48- gettimeofday (& current , NULL );
49- time_value = 1000000ul * current .tv_sec + current .tv_usec ;
50- #endif
5144
5245 return time_value ;
5346}
5447
5548static uint64_t mca_base_source_default_time_source_ticks (void )
5649{
57- #if OPAL_HAVE_CLOCK_GETTIME
58- return 1000000000 ;
59- #else
60- return 1000000 ;
61- #endif
50+ struct timespec spec ;
51+ if (0 == opal_clock_getres (& spec )){
52+ return (uint64_t )(spec .tv_sec + spec .tv_nsec );
53+ } else {
54+ /* guess */
55+ return 1000000 ;
56+ }
6257}
6358
6459/***************************************************************************************************/
You can’t perform that action at this time.
0 commit comments