Skip to content

replace old-time with time in measure from Test.Framework.Utils#137

Merged
skogsbaer merged 1 commit into
skogsbaer:mainfrom
dancewithheart:replace-old-time-time
May 11, 2026
Merged

replace old-time with time in measure from Test.Framework.Utils#137
skogsbaer merged 1 commit into
skogsbaer:mainfrom
dancewithheart:replace-old-time-time

Conversation

@dancewithheart
Copy link
Copy Markdown
Contributor

This replace deprecated old-time with time as hackage suggests:

Deprecated in favor of time

Tested with: stack test

@skogsbaer skogsbaer merged commit 9b910f8 into skogsbaer:main May 11, 2026
9 checks passed
Comment thread Test/Framework/Utils.hs
a <- ma
t1 <- a `seq` getClockTime
let diffMicro = t1 `diffClockTimes` t0
t1 <- a `seq` getMicroTime
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the seq doing there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think seq forces the result to weak head normal form (WHNF) before taking the end measurement.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I guess that makes sense. I think I suffer from blurry vision, somehow I was assuming that it forces t0 😹

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getPOSIXTime uses system clock (wall time), using getMonotonicTimeNSec measure time duration.

So your proposal @sol seems nice both semantically and practically - avoids wirdness e.g. automatic time change, admins doing their thing :)

@sol
Copy link
Copy Markdown

sol commented May 11, 2026

@skogsbaer you want to use a monotonic time source for that. Don't ask me for the exact function name, but it's in base by now.

@sol
Copy link
Copy Markdown

sol commented May 11, 2026

https://hackage-content.haskell.org/package/base-4.22.0.0/docs/GHC-Clock.html#v:getMonotonicTime

Comment thread HTF.cabal
random >= 1.0,
regex-compat >= 0.92,
text >= 0.11,
time >= 1.8 && < 1.15,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems unnecessary, given line below 😅

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you come up with a fix? Also for the monotonic time thingy?

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.

3 participants