Skip to content
Snippets Groups Projects
Commit 2cebe05b authored by altaic's avatar altaic Committed by Ian Lynagh
Browse files

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.
parent 6aae8dc2
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment