File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ {-# LANGUAGE CPP #-}
2+
13module SDL.Raw.Timer (
24 -- * Timer Support
35 addTimer ,
@@ -6,6 +8,10 @@ module SDL.Raw.Timer (
68 getPerformanceFrequency ,
79 getTicks ,
810 removeTimer
11+
12+ #ifdef RECENT_ISH
13+ , getTicks64
14+ #endif
915) where
1016
1117import Control.Monad.IO.Class
@@ -21,6 +27,10 @@ foreign import ccall "SDL.h SDL_GetPerformanceFrequency" getPerformanceFrequency
2127foreign import ccall " SDL.h SDL_GetTicks" getTicksFFI :: IO Word32
2228foreign import ccall " SDL.h SDL_RemoveTimer" removeTimerFFI :: TimerID -> IO Bool
2329
30+ #ifdef RECENT_ISH
31+ foreign import ccall " SDL.h SDL_GetTicks64" getTicks64FFI :: IO Word64
32+ #endif
33+
2434addTimer :: MonadIO m => Word32 -> TimerCallback -> Ptr () -> m TimerID
2535addTimer v1 v2 v3 = liftIO $ addTimerFFI v1 v2 v3
2636{-# INLINE addTimer #-}
@@ -44,3 +54,9 @@ getTicks = liftIO getTicksFFI
4454removeTimer :: MonadIO m => TimerID -> m Bool
4555removeTimer v1 = liftIO $ removeTimerFFI v1
4656{-# INLINE removeTimer #-}
57+
58+ #ifdef RECENT_ISH
59+ getTicks64 :: MonadIO m => m Word64
60+ getTicks64 = liftIO getTicks64FFI
61+ {-# INLINE getTicks64 #-}
62+ #endif
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE CPP #-}
12{-# LANGUAGE DeriveDataTypeable #-}
23{-# LANGUAGE DeriveGeneric #-}
34{-# LANGUAGE OverloadedStrings #-}
5+ {-# LANGUAGE CPP #-}
46module SDL.Time
57 ( -- * Time Measurement
68 ticks
@@ -13,6 +15,10 @@ module SDL.Time
1315 , RetriggerTimer (.. )
1416 , addTimer
1517 , removeTimer
18+
19+ #ifdef RECENT_ISH
20+ , ticks64
21+ #endif
1622 ) where
1723
1824import Control.Monad.IO.Class (MonadIO , liftIO )
@@ -93,3 +99,11 @@ addTimer timeout callback = liftIO $ do
9399-- See @<https://wiki.libsdl.org/SDL_RemoveTimer SDL_RemoveTimer>@ for C documentation.
94100removeTimer :: MonadIO m => Timer -> m Bool
95101removeTimer f = liftIO $ runTimerRemoval f
102+
103+ #ifdef RECENT_ISH
104+ -- | Number of milliseconds since library initialization.
105+ --
106+ -- See @<https://wiki.libsdl.org/SDL_GetTicks64 SDL_GetTicks64>@ for C documentation.
107+ ticks64 :: MonadIO m => m Word64
108+ ticks64 = Raw. getTicks64
109+ #endif
You can’t perform that action at this time.
0 commit comments