[commit: ghc] master: base: Fix ClockGetTime on OS X (2ddfb75)
git at git.haskell.org
git at git.haskell.org
Thu Mar 24 09:51:15 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/2ddfb7573793c2a288d0979868f876af75733426/ghc
>---------------------------------------------------------------
commit 2ddfb7573793c2a288d0979868f876af75733426
Author: Ben Gamari <bgamari.foss at gmail.com>
Date: Wed Mar 23 17:25:26 2016 +0100
base: Fix ClockGetTime on OS X
Apparently _POSIX_CPUTIME may be defined as -1 if
CLOCK_PROCESS_CPUTIME_ID isn't defined.
Test Plan: Validate
Reviewers: austin, hvr, erikd, goldfire
Reviewed By: erikd, goldfire
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2028
GHC Trac Issues: #11733
>---------------------------------------------------------------
2ddfb7573793c2a288d0979868f876af75733426
libraries/base/System/CPUTime.hsc | 2 +-
libraries/base/System/CPUTime/Posix/ClockGetTime.hsc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libraries/base/System/CPUTime.hsc b/libraries/base/System/CPUTime.hsc
index a6d934f..0475975 100644
--- a/libraries/base/System/CPUTime.hsc
+++ b/libraries/base/System/CPUTime.hsc
@@ -34,7 +34,7 @@ import System.IO.Unsafe (unsafePerformIO)
#if defined(mingw32_HOST_OS)
import qualified System.CPUTime.Windows as I
-#elif _POSIX_TIMERS > 0 && defined(_POSIX_CPUTIME)
+#elif _POSIX_TIMERS > 0 && defined(_POSIX_CPUTIME) && _POSIX_CPUTIME >= 0
import qualified System.CPUTime.Posix.ClockGetTime as I
#elif defined(HAVE_GETRUSAGE) && ! irix_HOST_OS && ! solaris2_HOST_OS
diff --git a/libraries/base/System/CPUTime/Posix/ClockGetTime.hsc b/libraries/base/System/CPUTime/Posix/ClockGetTime.hsc
index f4d224a..d7f2444 100644
--- a/libraries/base/System/CPUTime/Posix/ClockGetTime.hsc
+++ b/libraries/base/System/CPUTime/Posix/ClockGetTime.hsc
@@ -12,7 +12,7 @@ module System.CPUTime.Posix.ClockGetTime
, getCpuTimePrecision
) where
-#if defined(_POSIX_CPUTIME)
+#if _POSIX_TIMERS > 0 && defined(_POSIX_CPUTIME) && _POSIX_CPUTIME >= 0
import Foreign
import Foreign.C
More information about the ghc-commits
mailing list