[commit: old-time] master: Fix gettimeofday call on Win64 (b2c2c9d)
Ian Lynagh
igloo at earth.li
Tue May 1 22:59:59 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/old-time
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/b2c2c9d01c3c71a9a37c11b455aba63b7a3199c2
>---------------------------------------------------------------
commit b2c2c9d01c3c71a9a37c11b455aba63b7a3199c2
Author: Ian Lynagh <igloo at earth.li>
Date: Tue May 1 18:21:35 2012 +0100
Fix gettimeofday call on Win64
On both Win32 and Win64, timeval is defined to be a pair of longs.
>---------------------------------------------------------------
System/Time.hsc | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/System/Time.hsc b/System/Time.hsc
index 1ddddba..b2ff466 100644
--- a/System/Time.hsc
+++ b/System/Time.hsc
@@ -250,11 +250,20 @@ getClockTime = do
return (TOD (fromIntegral sec) ((fromIntegral usec) * 1000000))
#elif HAVE_GETTIMEOFDAY
+
+# if defined(mingw32_HOST_OS)
+type Timeval_tv_sec = CLong
+type Timeval_tv_usec = CLong
+# else
+type Timeval_tv_sec = CTime
+type Timeval_tv_usec = CSUSeconds
+# endif
+
getClockTime = do
allocaBytes (#const sizeof(struct timeval)) $ \ p_timeval -> do
throwErrnoIfMinus1_ "getClockTime" $ gettimeofday p_timeval nullPtr
- sec <- (#peek struct timeval,tv_sec) p_timeval :: IO CTime
- usec <- (#peek struct timeval,tv_usec) p_timeval :: IO CSUSeconds
+ sec <- (#peek struct timeval,tv_sec) p_timeval :: IO Timeval_tv_sec
+ usec <- (#peek struct timeval,tv_usec) p_timeval :: IO Timeval_tv_usec
return (TOD (realToInteger sec) ((realToInteger usec) * 1000000))
#elif HAVE_FTIME
More information about the Cvs-libraries
mailing list