1212 * All rights reserved.
1313 * Copyright (c) 2015 Research Organization for Information Science
1414 * and Technology (RIST). All rights reserved.
15- * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
15+ * Copyright (c) 2015-2016 Los Alamos National Security, LLC. All rights
1616 * reserved.
1717 * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
1818 * Copyright (c) 2016 Broadcom Limited. All rights reserved.
@@ -162,7 +162,7 @@ int opal_timer_linux_open(void)
162162{
163163 int ret = OPAL_SUCCESS ;
164164
165- if (mca_timer_base_monotonic ) {
165+ if (mca_timer_base_monotonic && ! opal_sys_timer_is_monotonic () ) {
166166#if OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_TIMER_MONOTONIC )
167167 struct timespec res ;
168168 if ( 0 == clock_getres (CLOCK_MONOTONIC , & res )) {
@@ -172,10 +172,8 @@ int opal_timer_linux_open(void)
172172 return ret ;
173173 }
174174#else
175- #if (0 == OPAL_TIMER_MONOTONIC )
176175 /* Monotonic time requested but cannot be found. Complain! */
177176 opal_show_help ("help-opal-timer-linux.txt" , "monotonic not supported" , true);
178- #endif /* (0 == OPAL_TIMER_MONOTONIC) */
179177#endif /* OPAL_HAVE_CLOCK_GETTIME && (0 == OPAL_TIMER_MONOTONIC) */
180178 }
181179 ret = opal_timer_linux_find_freq ();
@@ -187,22 +185,20 @@ int opal_timer_linux_open(void)
187185#if OPAL_HAVE_CLOCK_GETTIME
188186opal_timer_t opal_timer_base_get_usec_clock_gettime (void )
189187{
190- struct timespec tp ;
188+ struct timespec tp = {. tv_sec = 0 , . tv_nsec = 0 } ;
191189
192- if ( 0 == clock_gettime (CLOCK_MONOTONIC , & tp ) ) {
193- return (tp .tv_sec * 1e6 + tp .tv_nsec /1000 );
194- }
195- return 0 ;
190+ (void ) clock_gettime (CLOCK_MONOTONIC , & tp );
191+
192+ return (tp .tv_sec * 1e6 + tp .tv_nsec /1000 );
196193}
197194
198195opal_timer_t opal_timer_base_get_cycles_clock_gettime (void )
199196{
200- struct timespec tp ;
197+ struct timespec tp = {. tv_sec = 0 , . tv_nsec = 0 } ;
201198
202- if ( 0 == clock_gettime (CLOCK_MONOTONIC , & tp ) ) {
203- return (tp .tv_sec * 1e9 + tp .tv_nsec );
204- }
205- return 0 ;
199+ (void ) clock_gettime (CLOCK_MONOTONIC , & tp );
200+
201+ return (tp .tv_sec * 1e9 + tp .tv_nsec );
206202}
207203#endif /* OPAL_HAVE_CLOCK_GETTIME */
208204
0 commit comments