From 5ae298f6beb2da43f07d00d32fb32545a16ae90e Mon Sep 17 00:00:00 2001 From: Cristy Date: Sun, 7 Aug 2016 20:41:48 -0400 Subject: [PATCH] ... --- MagickCore/timer.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/MagickCore/timer.c b/MagickCore/timer.c index 7ba351f55..27819dace 100644 --- a/MagickCore/timer.c +++ b/MagickCore/timer.c @@ -188,7 +188,26 @@ MagickExport TimerInfo *DestroyTimerInfo(TimerInfo *timer_info) */ static double ElapsedTime(void) { -#if defined(MAGICKCORE_HAVE_TIMES) && defined(MAGICKCORE_HAVE_SYSCONF) +#if defined(HAVE_CLOCK_GETTIME) +#define NANOSECONDS_PER_SECOND 1000000000.0 +#if defined(CLOCK_HIGHRES) +# define CLOCK_ID CLOCK_HIGHRES +#elif defined(CLOCK_MONOTONIC_RAW) +# define CLOCK_ID CLOCK_MONOTONIC_RAW +#elif defined(CLOCK_MONOTONIC_PRECISE) +# define CLOCK_ID CLOCK_MONOTONIC_PRECISE +#elif defined(CLOCK_MONOTONIC) +# define CLOCK_ID CLOCK_MONOTONIC +#else +# define CLOCK_ID CLOCK_REALTIME +#endif + + struct timespec + timer; + + (void) clock_gettime(CLOCK_ID,&timer); + return((double) timer.tv_sec+timer.tv_nsec/NANOSECONDS_PER_SECOND); +#elif defined(MAGICKCORE_HAVE_TIMES) && defined(MAGICKCORE_HAVE_SYSCONF) struct tms timer; -- 2.40.0