Fix GetTime.c on Darwin with clock_gettime
authorMisty De Meo <mistydemeo@github.com>
Wed, 15 Jun 2016 22:02:13 +0000 (15:02 -0700)
committerBen Gamari <ben@smart-cactus.org>
Mon, 25 Jul 2016 15:04:34 +0000 (17:04 +0200)
On Darwin versions with clock_gettime, #ifdefs will prevent the
mach-specific time functions from being used in most places, and
the mach time headers won't be included; however, this section
was guarded incorrectly and would still try to use them.

Fixes #12195.

(cherry picked from commit b7b130c5102948b38aaba723044288e16a80d492)

rts/posix/GetTime.c

index def78a4..f6182f9 100644 (file)
 // we'll implement getProcessCPUTime() and getProcessElapsedTime()
 // separately, using getrusage() and gettimeofday() respectively
 
-#ifdef darwin_HOST_OS
+#if !defined(HAVE_CLOCK_GETTIME) && defined(darwin_HOST_OS)
 static uint64_t timer_scaling_factor_numer = 0;
 static uint64_t timer_scaling_factor_denom = 0;
 #endif
 
 void initializeTimer()
 {
-#ifdef darwin_HOST_OS
+#if !defined(HAVE_CLOCK_GETTIME) && defined(darwin_HOST_OS)
     mach_timebase_info_data_t info;
     (void) mach_timebase_info(&info);
     timer_scaling_factor_numer = (uint64_t)info.numer;