X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FTime.hsc;h=d7ae3f53a35782bbe7fefe44878f5e80c0ecf8e0;hb=2570f264ed329f04017d507250494eb0ab680d64;hp=74293eeeb60a5b68315ae1a4fae9b4b8c85d64a1;hpb=69b2983d1ef10fefe155db9f777b9201e4c5b447;p=haskell-directory.git diff --git a/System/Time.hsc b/System/Time.hsc index 74293ee..d7ae3f5 100644 --- a/System/Time.hsc +++ b/System/Time.hsc @@ -455,13 +455,16 @@ throwAwayReturnPointer :: (Ptr CTime -> Ptr CTm -> IO (Ptr CTm)) -> (Ptr CTime -> Ptr CTm -> IO ( )) throwAwayReturnPointer fun x y = fun x y >> return () +#if !HAVE_LOCALTIME_R || !HAVE_GMTIME_R clockToCalendarTime_static :: (Ptr CTime -> IO (Ptr CTm)) -> Bool -> ClockTime -> IO CalendarTime clockToCalendarTime_static fun is_utc (TOD secs psec) = do with (fromIntegral secs :: CTime) $ \ p_timer -> do p_tm <- fun p_timer -- can't fail, according to POSIX clockToCalendarTime_aux is_utc p_tm psec +#endif +#if HAVE_LOCALTIME_R || HAVE_GMTIME_R clockToCalendarTime_reentrant :: (Ptr CTime -> Ptr CTm -> IO ()) -> Bool -> ClockTime -> IO CalendarTime clockToCalendarTime_reentrant fun is_utc (TOD secs psec) = do @@ -469,6 +472,7 @@ clockToCalendarTime_reentrant fun is_utc (TOD secs psec) = do allocaBytes (#const sizeof(struct tm)) $ \ p_tm -> do fun p_timer p_tm clockToCalendarTime_aux is_utc p_tm psec +#endif clockToCalendarTime_aux :: Bool -> Ptr CTm -> Integer -> IO CalendarTime clockToCalendarTime_aux is_utc p_tm psec = do @@ -733,21 +737,19 @@ foreign import ccall unsafe "time.h gmtime" #endif foreign import ccall unsafe "time.h mktime" mktime :: Ptr CTm -> IO CTime -foreign import ccall unsafe "time.h time" - time :: Ptr CTime -> IO CTime #if HAVE_GETTIMEOFDAY type CTimeVal = () foreign import ccall unsafe "time.h gettimeofday" gettimeofday :: Ptr CTimeVal -> Ptr () -> IO CInt -#endif - -#if HAVE_FTIME +#elif HAVE_FTIME type CTimeB = () #ifndef mingw32_HOST_OS foreign import ccall unsafe "time.h ftime" ftime :: Ptr CTimeB -> IO CInt #else foreign import ccall unsafe "time.h ftime" ftime :: Ptr CTimeB -> IO () #endif +#else +foreign import ccall unsafe "time.h time" time :: Ptr CTime -> IO CTime #endif #endif /* ! __HUGS__ */