[project @ 2002-12-19 15:23:29 by ross]
[haskell-directory.git] / System / CPUTime.hsc
index 77a8e24..b9678a3 100644 (file)
@@ -20,13 +20,20 @@ module System.CPUTime
 
 import Prelude
 
+import Data.Ratio
+
+#ifdef __HUGS__
+import Hugs.Time ( getCPUTime, clockTicks )
+#endif
+
+#ifdef __GLASGOW_HASKELL__
 import Foreign
 import Foreign.C
 
-import Data.Ratio
-
 #include "HsBase.h"
+#endif
 
+#ifdef __GLASGOW_HASKELL__
 -- -----------------------------------------------------------------------------
 -- |Computation 'getCPUTime' returns the number of picoseconds CPU time
 -- used by the current program.  The precision of this result is
@@ -106,6 +113,7 @@ foreign import ccall unsafe "GetCurrentProcess" getCurrentProcess :: IO (Ptr HAN
 foreign import ccall unsafe "GetProcessTimes" getProcessTimes :: Ptr HANDLE -> Ptr FILETIME -> Ptr FILETIME -> Ptr FILETIME -> Ptr FILETIME -> IO CInt
 
 #endif /* not _WIN32 */
+#endif /* __GLASGOW_HASKELL__ */
 
 -- |The 'cpuTimePrecision' constant is the smallest measurable difference
 -- in CPU time that the implementation can record, and is given as an
@@ -114,6 +122,7 @@ foreign import ccall unsafe "GetProcessTimes" getProcessTimes :: Ptr HANDLE -> P
 cpuTimePrecision :: Integer
 cpuTimePrecision = round ((1000000000000::Integer) % fromIntegral (clockTicks))
 
+#ifdef __GLASGOW_HASKELL__
 clockTicks :: Int
 clockTicks =
 #if defined(CLK_TCK)
@@ -122,3 +131,4 @@ clockTicks =
     unsafePerformIO (sysconf (#const _SC_CLK_TCK) >>= return . fromIntegral)
 foreign import ccall unsafe sysconf :: CInt -> IO CLong
 #endif
+#endif /* __GLASGOW_HASKELL__ */