posix-timer 0.2 → 0.2.0.1
raw patch · 4 files changed
+31/−8 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- include/posix-timer.macros.h +1/−1
- posix-timer.cabal +1/−1
- src/System/Posix/Clock.hsc +24/−5
- src/System/Posix/Timer.hsc +5/−1
include/posix-timer.macros.h view
@@ -2,7 +2,7 @@ #define POSIX_TIMER_MACROS_H #define hsc_itype(t) \- printf("%s%i", ((t)(-1)) < 0 ? "Int" : "Word", sizeof (t) * 8);+ printf("%s%lu", ((t)(-1)) < 0 ? "Int" : "Word", sizeof (t) * 8); #endif /* POSIX_TIMER_MACROS_H */
posix-timer.cabal view
@@ -1,5 +1,5 @@ Name: posix-timer-Version: 0.2+Version: 0.2.0.1 Category: System Stability: experimental Synopsis: Bindings to POSIX clock and timer functions.
src/System/Posix/Clock.hsc view
@@ -37,10 +37,20 @@ import Foreign.Storable (Storable(..)) import Foreign.Marshal.Alloc (alloca) import Foreign.Marshal.Utils (with)-import Foreign.C.Types (CInt, CULong, CTime)+import Foreign.C.Types (CULong)+#if __GLASGOW_HASKELL__ >= 703+import Foreign.C.Types (CInt(..), CTime(..))+#else+import Foreign.C.Types (CInt, CTime)+#endif import Foreign.C.Error (getErrno, eINTR, throwErrno, throwErrnoIfMinus1_)+#if __GLASGOW_HASKELL__ >= 703+import System.Posix.Types (CPid(..))+#endif import System.Posix.Types (ProcessID)+#if __GLASGOW_HASKELL__ < 703 import Unsafe.Coerce (unsafeCoerce)+#endif #include <time.h> #include <HsBaseConfig.h>@@ -120,7 +130,11 @@ then error "TimeSpec.fromEnum" else fromIntegral s' * nsPerSecond + fromIntegral ns where s', minSecs, maxSecs ∷ #{itype time_t}+#if __GLASGOW_HASKELL__ >= 703+ CTime s' = s+#else s' = unsafeCoerce s+#endif minSecs = fromIntegral minSecsInInt maxSecs = fromIntegral maxSecsInInt minNs, maxNs ∷ CULong@@ -153,12 +167,17 @@ timeSpecToInt64 ∷ TimeSpec → Int64 timeSpecToInt64 (TimeSpec s ns) =-#if HTYPE_TIME_T == Int64+#if __GLASGOW_HASKELL__ >= 703+ let CTime s' = s in+ fromIntegral s' * nsPerSecond ++#else+# if HTYPE_TIME_T == Int64 (unsafeCoerce s ∷ Int64) * nsPerSecond +-#elif HTYPE_TIME_T == Int32+# elif HTYPE_TIME_T == Int32 (fromIntegral (unsafeCoerce s ∷ Int32) ∷ Int64) * nsPerSecond +-#else-# error FIXME: timeSpecToInt64: unexpected HTYPE_TIME_T value+# else+# error FIXME: timeSpecToInt64: unexpected HTYPE_TIME_T value+# endif #endif fromIntegral ns {-# INLINE timeSpecToInt64 #-}
src/System/Posix/Timer.hsc view
@@ -22,10 +22,14 @@ import Foreign.Ptr (Ptr, WordPtr, nullPtr, castPtr) import Foreign.Marshal.Alloc (alloca, allocaBytes) import Foreign.Marshal.Utils (with)+#if __GLASGOW_HASKELL__ >= 703+import Foreign.C.Types (CInt(..))+#else import Foreign.C.Types (CInt)+#endif import Foreign.C.Error (throwErrnoIfMinus1, throwErrnoIfMinus1_) import System.Posix.Signals (Signal)-import System.Posix.Clock (TimeSpec, Clock)+import System.Posix.Clock (TimeSpec, Clock(..)) #include <time.h> #include <signal.h>