Skip to content

Replace getPOSIXTime with getMonotonicTimeNSec#138

Merged
skogsbaer merged 2 commits into
skogsbaer:mainfrom
dancewithheart:monotonic-time
May 15, 2026
Merged

Replace getPOSIXTime with getMonotonicTimeNSec#138
skogsbaer merged 2 commits into
skogsbaer:mainfrom
dancewithheart:monotonic-time

Conversation

@dancewithheart
Copy link
Copy Markdown
Contributor

@dancewithheart dancewithheart commented May 12, 2026

  • use getMonotonicTimeNSec - Thank you @sol for spotting this!
  • clean up time dependency
  • getMonotonicTimeNSec is in base 4.11 and this is incompatible with GHC 8.8 so added conditional logic

Tested with toy example:

import Test.Framework.Utils
import Control.Concurrent (threadDelay)

main :: IO ()
main = do
  t0 <- getMicroTime
  threadDelay 10000
  t1 <- getMicroTime
  putStrLn $ "getMicroTime in micro sec = " <> show (t1 - t0)

  (_, elapsed) <- measure (threadDelay 10000)
  putStrLn $ "measure in mili sec = " <> show elapsed

that executed cabal exec -- runghc SmokeTest.hs produces:

getMicroTime in micro sec = 10412
measure in mili sec = 10

Similar numbers before change.

@dancewithheart dancewithheart marked this pull request as draft May 12, 2026 10:27
@skogsbaer skogsbaer merged commit 76b7db6 into skogsbaer:main May 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants