[commit: old-time] master: Use CSUSeconds rather than CTime in getClockTime. Fixes #4970. (2cebe05)
Ian Lynagh
igloo at earth.li
Sun Jun 12 17:22:53 CEST 2011
Repository : ssh://darcs.haskell.org//srv/darcs/packages/old-time
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/2cebe05be7304c813b7edc29ca583b32a7b7c879
>---------------------------------------------------------------
commit 2cebe05be7304c813b7edc29ca583b32a7b7c879
Author: William Knop <william.knop.nospam at gmail.com>
Date: Mon Apr 4 21:15:27 2011 -0400
Use CSUSeconds rather than CTime in getClockTime. Fixes #4970.
The tv_usec field of struct timeval was incorrectly used as C type time_t; the actual C type is suseconds_t. On OS X, time_t is longer than suseconds_t, which caused garbage bits to be copied as reported in trace #4247 and #4970. This is patch 4 of 4 to fix those tickets.
>---------------------------------------------------------------
System/Time.hsc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/System/Time.hsc b/System/Time.hsc
index 663e875..ecd83c2 100644
--- a/System/Time.hsc
+++ b/System/Time.hsc
@@ -250,7 +250,7 @@ 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 CTime
+ usec <- (#peek struct timeval,tv_usec) p_timeval :: IO CSUSeconds
return (TOD (realToInteger sec) ((realToInteger usec) * 1000000))
#elif HAVE_FTIME
More information about the Cvs-libraries
mailing list