From 21743f95163820b737224a503a74c594b5c4ec10 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov <mikhail.glushenkov@gmail.com> Date: Tue, 16 Feb 2016 15:08:17 +0100 Subject: [PATCH] Display the calculated mtime delay correctly. --- cabal-install/tests/UnitTests.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cabal-install/tests/UnitTests.hs b/cabal-install/tests/UnitTests.hs index 053bfc8b67..b42079d620 100644 --- a/cabal-install/tests/UnitTests.hs +++ b/cabal-install/tests/UnitTests.hs @@ -66,7 +66,8 @@ main = do (tests mtimeChangeDelay) -- Based on code written by Neill Mitchell for Shake. See --- 'sleepFileTimeCalibrate' in 'Test.Type'. +-- 'sleepFileTimeCalibrate' in 'Test.Type'. The returned delay is never smaller +-- than 10 ms, but never larger than 1 second. calibrateMtimeChangeDelay :: IO Int calibrateMtimeChangeDelay = do withTempDirectory silent "." "calibration-" $ \dir -> do @@ -81,8 +82,8 @@ calibrateMtimeChangeDelay = do spin (0::Int) let mtimeChange = maximum mtimes putStrLn $ "Mtime delay calibration completed, calculated delay: " - ++ (show mtimeChange) ++ " ms." - return $ min 1000000 mtimeChange + ++ (show $ fromIntegral mtimeChange / (1000.0 :: Double)) ++ " ms." + return $ min 1000000 (max 10000 mtimeChange) where time :: IO () -> IO Int time act = do -- GitLab