Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Exception: Time.toClockTime: picoseconds out of range
Got the "picoseconds out of range" exception when using addToClockTime TimeDiff ClockTime from System.Time If you evaluate test1 or test3 you will either get a result or an exception.\[\[BR\]\] If you evaluate test2 you'll see that the TimeDiff often has a picosecond field that results in values outside the \[0..999999999999\] range enforced by 'toClockTime' of Time.hsc, as called from 'addToClockTime' in Time.hsc. ``` --BEGIN CODE-- module Test where import System.IO import System.Time testTD = TimeDiff { tdYear = 0, tdMonth = 0, tdDay = 0, tdHour = 0, tdMin = 10, tdSec = 0, tdPicosec = 0 } test1 t = do to <- tdUntil (addToClockTime testTD t) >>= return . tdToSeconds hPutStrLn stdout ("timeout is:" ++ show to) test2 t = do td <- tdUntil (addToClockTime testTD t)-- >>= return . tdToSeconds hPutStrLn stdout ("timediff is: " ++ show td) test3 t = do toct <- tdUntil (addToClockTime testTD t) >>= return . (\td -> addToClockTime td (TOD 0 0)) hPutStrLn stdout ("timeout ct is" ++ show toct) tdToSeconds :: TimeDiff -> Integer tdToSeconds td = s where TOD s p = addToClockTime td (TOD 0 0) tdUntil :: ClockTime -> IO TimeDiff tdUntil ct = getClockTime >>= return . (diffClockTimes ct) --END CODE-- ``` <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ------------ | | Version | 6.4.1 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | GHCi | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"Exception: Time.toClockTime: picoseconds out of range","status":"New","operating_system":"","component":"GHCi","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"6.4.1","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":[""],"type":"Bug","description":"Got the \"picoseconds out of range\" exception when using addToClockTime TimeDiff ClockTime from System.Time\r\n\r\nIf you evaluate test1 or test3 you will either get a result or an exception.[[BR]]\r\nIf you evaluate test2 you'll see that the TimeDiff often has a picosecond field that results in values outside the [0..999999999999] range enforced by 'toClockTime' of Time.hsc, as called from 'addToClockTime' in Time.hsc.\r\n\r\n{{{\r\n--BEGIN CODE--\r\nmodule Test where\r\n\r\nimport System.IO\r\nimport System.Time\r\n\r\ntestTD = TimeDiff {\r\n tdYear = 0,\r\n tdMonth = 0,\r\n tdDay = 0,\r\n tdHour = 0,\r\n tdMin = 10,\r\n tdSec = 0,\r\n tdPicosec = 0\r\n }\r\n\r\ntest1 t = do\r\n to <- tdUntil (addToClockTime testTD t) >>= return . tdToSeconds\r\n hPutStrLn stdout (\"timeout is:\" ++ show to)\r\n\r\ntest2 t = do\r\n td <- tdUntil (addToClockTime testTD t)-- >>= return . tdToSeconds\r\n hPutStrLn stdout (\"timediff is: \" ++ show td)\r\n\r\ntest3 t = do\r\n toct <- tdUntil (addToClockTime testTD t) >>= return . (\\td -> addToClockTime td (TOD 0 0))\r\n hPutStrLn stdout (\"timeout ct is\" ++ show toct)\r\n\r\ntdToSeconds :: TimeDiff -> Integer\r\ntdToSeconds td = s where\r\n TOD s p = addToClockTime td (TOD 0 0)\r\n\r\ntdUntil :: ClockTime -> IO TimeDiff\r\ntdUntil ct = getClockTime >>= return . (diffClockTimes ct)\r\n--END CODE--\r\n}}}","type_of_failure":"OtherFailure","blocking":[]} -->
issue