[Haskell-cafe] getCPUTime ??

Jon Fairbairn Jon.Fairbairn at cl.cam.ac.uk
Mon Nov 21 16:22:08 EST 2005


On 2005-11-21 at 15:14EST Michael Benfield wrote:
> I'm new to Haskell. I'm apparently misunderstanding something here.
> 
> When I run this program:
> 
> ---------
> module Main where
> 
> import System.Posix
> import System.CPUTime
> 
> printTime = getCPUTime >>= putStrLn . show
> 
> main = printTime >> sleep 5 >> printTime
> ---------
> 
> It produces this output:
> 1430000000000
> 1430000000000
> 
> or similar. In any case, both the numbers are the same. Should the 
> second number not reflect a time 5 seconds later than the first? I've 
> tried this with both GHC and Hugs, and both give me the same thing.

Should 'sleep 5' take any CPU time?
 
-- 
Jón Fairbairn                              Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list