diff --git a/Data/Time/Clock/CTimeval.hs b/Data/Time/Clock/CTimeval.hs index 5e0ffdf59ee120c4ad3592eb6f9a0c8c5069e198..b0d8920caa67574e99e5b1732f72d07cef28138a 100644 --- a/Data/Time/Clock/CTimeval.hs +++ b/Data/Time/Clock/CTimeval.hs @@ -25,10 +25,8 @@ foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeval - -- | Get the current POSIX time from the system clock. getCTimeval :: IO CTimeval getCTimeval = with (MkCTimeval 0 0) (\ptval -> do - result <- gettimeofday ptval nullPtr - if (result == 0) - then peek ptval - else fail ("error in gettimeofday: " ++ (show result)) + throwErrnoIfMinus1_ "gettimeofday" $ gettimeofday ptval nullPtr + peek ptval ) #endif