From: Simon Marlow Date: Wed, 5 Dec 2007 12:01:18 +0000 (+0000) Subject: FIX #1621: bug in Windows code for getCPUTime X-Git-Url: http://git.megacz.com/?p=ghc-base.git;a=commitdiff_plain;h=e5b9b2f03cfc0eaa16edf19bcba422ea639d154d FIX #1621: bug in Windows code for getCPUTime We were reading the components of FILETIME as CLong, when they should be unsigned. Word32 seems to be the correct type here. --- diff --git a/System/CPUTime.hsc b/System/CPUTime.hsc index 3309c2c..2846d4c 100644 --- a/System/CPUTime.hsc +++ b/System/CPUTime.hsc @@ -108,8 +108,8 @@ foreign import ccall unsafe times :: Ptr CTms -> IO CClock where ft2psecs :: Ptr FILETIME -> IO Integer ft2psecs ft = do - high <- (#peek FILETIME,dwHighDateTime) ft :: IO CLong - low <- (#peek FILETIME,dwLowDateTime) ft :: IO CLong + high <- (#peek FILETIME,dwHighDateTime) ft :: IO Word32 + low <- (#peek FILETIME,dwLowDateTime) ft :: IO Word32 -- Convert 100-ns units to picosecs (10^-12) -- => multiply by 10^5. return (((fromIntegral high) * (2^32) + (fromIntegral low)) * 100000)