blob: 7f98a03cd2355af89f3f8cca4ed377650cc5eec6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
module GHC.Event.Clock
( getMonotonicTime
, getMonotonicTimeNSec
) where
import GHC.Base
import GHC.Real
import Data.Word
-- | Return monotonic time in seconds, since some unspecified starting point
getMonotonicTime :: IO Double
getMonotonicTime = do w <- getMonotonicTimeNSec
return (fromIntegral w / 1000000000)
-- | Return monotonic time in nanoseconds, since some unspecified starting point
foreign import ccall unsafe "getMonotonicNSec"
getMonotonicTimeNSec :: IO Word64
|