Sleep for a number of seconds.
fmap (round . fst) (duration $ sleep 1) == return 1
timeout (-3) (print 1) == return Nothing timeout 0.1 (print 1) == fmap Just (print 1) do (t, _) <- duration $ timeout 0.1 $ sleep 1000; print t; return $ t < 1 timeout 0.1 (sleep 2 >> print 1) == return Nothing
Deprecated: Function is being retired - use diffUTCTime directly.
Calculate the difference between two times in seconds. Usually the first time will be the end of an event, and the second time will be the beginning.
Show a number of seconds, typically a duration, in a suitable manner with responable precision for a human.
showDuration 3.435 == "3.44s" showDuration 623.8 == "10m24s" showDuration 62003.8 == "17h13m" showDuration 1e8 == "27777h47m"
Call once to start, then call repeatedly to get the elapsed time since the first call. The time is guaranteed to be monotonic. This function is robust to system time changes.
do f <- offsetTime; xs <- replicateM 10 f; return $ xs == sort xs
Deprecated: Use offsetTime instead, which is guaranteed to always increase.
A synonym for