diff options
author | Tom Sydney Kerckhove <syd.kerckhove@gmail.com> | 2017-10-18 16:24:46 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-10-19 16:40:09 -0400 |
commit | 1ba28510e0731d91fcab560269c4ed5950d5e458 (patch) | |
tree | 4d6f6ecbc95b0a773c9a020c4cdc198426242a9a | |
parent | 3befc1af5d9f84a1e6b7a7eb66c949a5a50ef853 (diff) | |
download | haskell-1ba28510e0731d91fcab560269c4ed5950d5e458.tar.gz |
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
-rw-r--r-- | libraries/base/GHC/Clock.hsc (renamed from libraries/base/GHC/Event/Clock.hsc) | 6 | ||||
-rw-r--r-- | libraries/base/GHC/Event/TimerManager.hs | 2 | ||||
-rw-r--r-- | libraries/base/base.cabal | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/libraries/base/GHC/Event/Clock.hsc b/libraries/base/GHC/Clock.hsc index 7f98a03cd2..6339dc0a52 100644 --- a/libraries/base/GHC/Event/Clock.hsc +++ b/libraries/base/GHC/Clock.hsc @@ -1,7 +1,7 @@ {-# 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 diff --git a/libraries/base/GHC/Event/TimerManager.hs b/libraries/base/GHC/Event/TimerManager.hs index f3dbb21686..b7e7615721 100644 --- a/libraries/base/GHC/Event/TimerManager.hs +++ b/libraries/base/GHC/Event/TimerManager.hs @@ -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) diff --git a/libraries/base/base.cabal b/libraries/base/base.cabal index 2b9d557490..43c7882253 100644 --- a/libraries/base/base.cabal +++ b/libraries/base/base.cabal @@ -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 |