Skip to content

Commit eab4d8c

Browse files
committed
SuiteSparse_config: Use configure result for whether to use clock_gettime
Use result of feature test to decide whether `clock_gettime` can be used.
1 parent 55c5a2f commit eab4d8c

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

SuiteSparse_config/Config/SuiteSparse_config.h.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,13 @@ int SuiteSparse_divcomplex
372372
// but other packages can themselves use OpenMP. In this case,
373373
// those packages should use omp_get_wtime() directly. This can
374374
// be done via the SUITESPARSE_TIME macro, defined below:
375+
#cmakedefine SUITESPARSE_HAVE_CLOCK_GETTIME
375376
#if defined ( _OPENMP )
376377
#define SUITESPARSE_TIMER_ENABLED
377378
#define SUITESPARSE_TIME (omp_get_wtime ( ))
378-
#elif defined ( _POSIX_C_SOURCE )
379-
#if _POSIX_C_SOURCE >= 199309L
379+
#elif defined ( SUITESPARSE_HAVE_CLOCK_GETTIME )
380380
#define SUITESPARSE_TIMER_ENABLED
381381
#define SUITESPARSE_TIME (SuiteSparse_time ( ))
382-
#endif
383382
#else
384383
// No timer is available
385384
#define SUITESPARSE_TIME (0)

SuiteSparse_config/SuiteSparse_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ void *SuiteSparse_free /* always returns NULL */
495495
tic [1] = 0 ;
496496
}
497497

498-
#else
498+
#else
499499

500500
/* ---------------------------------------------------------------------- */
501501
/* POSIX timer */
@@ -616,7 +616,7 @@ double SuiteSparse_hypot (double x, double y)
616616
r = x / y ;
617617
s = y * sqrt (1.0 + r*r) ;
618618
}
619-
}
619+
}
620620
return (s) ;
621621
}
622622

SuiteSparse_config/SuiteSparse_config.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,14 +372,13 @@ int SuiteSparse_divcomplex
372372
// but other packages can themselves use OpenMP. In this case,
373373
// those packages should use omp_get_wtime() directly. This can
374374
// be done via the SUITESPARSE_TIME macro, defined below:
375+
#define SUITESPARSE_HAVE_CLOCK_GETTIME
375376
#if defined ( _OPENMP )
376377
#define SUITESPARSE_TIMER_ENABLED
377378
#define SUITESPARSE_TIME (omp_get_wtime ( ))
378-
#elif defined ( _POSIX_C_SOURCE )
379-
#if _POSIX_C_SOURCE >= 199309L
379+
#elif defined ( SUITESPARSE_HAVE_CLOCK_GETTIME )
380380
#define SUITESPARSE_TIMER_ENABLED
381381
#define SUITESPARSE_TIME (SuiteSparse_time ( ))
382-
#endif
383382
#else
384383
// No timer is available
385384
#define SUITESPARSE_TIME (0)

0 commit comments

Comments
 (0)