summaryrefslogtreecommitdiff
path: root/dev-haskell/time-compat/files/fix-resolution-test.patch
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-06 13:21:55 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-10-06 13:21:55 +0100
commit275074c50dca7b941cc7cd7966a2ace71c29ecae (patch)
treee22b9ca529098f2d687b61bc9b0eb711b0990cc3 /dev-haskell/time-compat/files/fix-resolution-test.patch
parent86b151cdc26e1566efef728aac4ebb2aabce776a (diff)
gentoo auto-resync : 06:10:2022 - 13:21:55
Diffstat (limited to 'dev-haskell/time-compat/files/fix-resolution-test.patch')
-rw-r--r--dev-haskell/time-compat/files/fix-resolution-test.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/dev-haskell/time-compat/files/fix-resolution-test.patch b/dev-haskell/time-compat/files/fix-resolution-test.patch
new file mode 100644
index 000000000000..918bd488dbc9
--- /dev/null
+++ b/dev-haskell/time-compat/files/fix-resolution-test.patch
@@ -0,0 +1,49 @@
+https://github.com/haskellari/time-compat/pull/33
+
+From 9f7aa0a5937b800402359c3e82f4bee296ae8e06 Mon Sep 17 00:00:00 2001
+From: matoro <matoro@users.noreply.github.com>
+Date: Fri, 16 Sep 2022 11:19:20 -0400
+Subject: [PATCH] Backport 6516a35 "fix resolution test" from time
+
+The upstream version of time was incorrect in newer versions until
+https://github.com/haskell/time/commit/6516a35b3d8cad14a21a559a5d2fc22ddda32fcc.
+Because the compat implementation was correct and the upstream version
+of time is now logically identical, simply replace both versions with
+the current upstream time implementation.
+
+See https://github.com/haskellari/time-compat/issues/31 for details on
+which platforms the distinction matters. Does NOT close that issue
+though, because the original issue is for platforms on which the actual
+resolution is less precise than the expected, and this will only fix
+platforms on which the actual resolution is more precise.
+---
+ test/main/Test/Clock/Resolution.hs | 9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+diff --git a/test/main/Test/Clock/Resolution.hs b/test/main/Test/Clock/Resolution.hs
+index aab756b..4c0b1dd 100644
+--- a/test/main/Test/Clock/Resolution.hs
++++ b/test/main/Test/Clock/Resolution.hs
+@@ -25,7 +25,7 @@ gcdAll :: Real a => [a] -> a
+ gcdAll = foldr gcd' 0
+
+ testResolution :: (Show dt, Real dt) => String -> (at -> at -> dt) -> (dt, IO at) -> TestTree
+-testResolution name timeDiff (res, getTime) =
++testResolution name timeDiff (reportedRes, getTime) =
+ testCase name $ do
+ t0 <- getTime
+ times0 <-
+@@ -53,11 +53,8 @@ testResolution name timeDiff (res, getTime) =
+ threadDelay 1000 -- 1ms
+ getTime
+ let times = fmap (\t -> timeDiff t t0) $ times0 ++ times1 ++ times2 ++ times3 ++ times4
+-#if MIN_VERSION_time(1,8,0)
+- assertEqual "resolution" res $ gcdAll times
+-#else
+- assertBool ("resolution " ++ show (res, gcdAll times)) (res >= gcdAll times)
+-#endif
++ foundGrid = gcdAll times
++ assertBool ("resolution " ++ show (reportedRes, foundGrid)) (foundGrid <= reportedRes)
+
+ testResolutions :: TestTree
+ testResolutions =