Commit 1ba28510 authored by Mr Kerckhove's avatar Mr Kerckhove Committed by Ben Gamari

Expose monotonic time from GHC.Event.Clock

This diff exposes the monotonic time api from GHC.Event.Clock.

This is necessary for future work on regression tests (#D4074) for
the timeout problems (8684, for example) in #D4041, #D4011, #D4012

Test Plan: Still builds ...

Reviewers: nh2, bgamari, austin, hvr

Reviewed By: bgamari

Subscribers: rwbarton, thomie

Differential Revision: https://phabricator.haskell.org/D4079
parent 3befc1af
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
module GHC.Event.Clock
module GHC.Clock
( getMonotonicTime
, getMonotonicTimeNSec
) where
......@@ -11,11 +11,15 @@ import GHC.Real
import Data.Word
-- | Return monotonic time in seconds, since some unspecified starting point
--
-- @since 4.11.0.0
getMonotonicTime :: IO Double
getMonotonicTime = do w <- getMonotonicTimeNSec
return (fromIntegral w / 1000000000)
-- | Return monotonic time in nanoseconds, since some unspecified starting point
--
-- @since 4.11.0.0
foreign import ccall unsafe "getMonotonicNSec"
getMonotonicTimeNSec :: IO Word64
......@@ -43,11 +43,11 @@ import Data.Foldable (sequence_)
import Data.IORef (IORef, atomicModifyIORef', mkWeakIORef, newIORef, readIORef,
writeIORef)
import GHC.Base
import GHC.Clock (getMonotonicTimeNSec)
import GHC.Conc.Signal (runHandlers)
import GHC.Num (Num(..))
import GHC.Real (fromIntegral)
import GHC.Show (Show(..))
import GHC.Event.Clock (getMonotonicTimeNSec)
import GHC.Event.Control
import GHC.Event.Internal (Backend, Event, evtRead, Timeout(..))
import GHC.Event.Unique (Unique, UniqueSource, newSource, newUnique)
......
......@@ -204,6 +204,7 @@ Library
GHC.Base
GHC.ByteOrder
GHC.Char
GHC.Clock
GHC.Conc
GHC.Conc.IO
GHC.Conc.Signal
......@@ -369,7 +370,6 @@ Library
other-modules:
GHC.Event.Arr
GHC.Event.Array
GHC.Event.Clock
GHC.Event.Control
GHC.Event.EPoll
GHC.Event.IntTable
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment