[commit: packages/time] ghc-head: use throwErrnoIfMinus1 gettimeofday for consistency in error handling (3e15640)
git at git.haskell.org
git at git.haskell.org
Fri Aug 30 17:47:23 CEST 2013
Repository : ssh://git@git.haskell.org/time
On branch : ghc-head
Link : http://git.haskell.org/?p=packages/time.git;a=commit;h=3e15640c74939e8929c46f15eaa7bc48cc79be66
>---------------------------------------------------------------
commit 3e15640c74939e8929c46f15eaa7bc48cc79be66
Author: Dylan Simon <dylan at dylex.net>
Date: Sat Jan 26 02:59:54 2013 +0000
use throwErrnoIfMinus1 gettimeofday for consistency in error handling
>---------------------------------------------------------------
3e15640c74939e8929c46f15eaa7bc48cc79be66
Data/Time/Clock/CTimeval.hs | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/Data/Time/Clock/CTimeval.hs b/Data/Time/Clock/CTimeval.hs
index 5e0ffdf..b0d8920 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
More information about the ghc-commits
mailing list