| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
SDL3.Sys.Bindgen.Timer.Safe
Synopsis
- sDL_GetTicks :: IO Uint64
- sDL_GetTicksNS :: IO Uint64
- sDL_GetPerformanceCounter :: IO Uint64
- sDL_GetPerformanceFrequency :: IO Uint64
- sDL_Delay :: Uint32 -> IO ()
- sDL_DelayNS :: Uint64 -> IO ()
- sDL_DelayPrecise :: Uint64 -> IO ()
- sDL_AddTimer :: Uint32 -> SDL_TimerCallback -> Ptr Void -> IO SDL_TimerID
- sDL_AddTimerNS :: Uint64 -> SDL_NSTimerCallback -> Ptr Void -> IO SDL_TimerID
- sDL_RemoveTimer :: SDL_TimerID -> IO CBool
Documentation
sDL_GetTicks :: IO Uint64 Source #
Get the number of milliseconds that have elapsed since the SDL library initialization.
- Returns
- an unsigned 64‑bit integer that represents the number of milliseconds that have elapsed since the SDL library was initialized (typically via a call to SDL_Init).
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetTicksNS- C declaration
SDL_GetTicks, defined atSDL3/SDL_timer.h 201:36
Since: 3.2.0
sDL_GetTicksNS :: IO Uint64 Source #
Get the number of nanoseconds since SDL library initialization.
- Returns
- an unsigned 64-bit value representing the number of nanoseconds since the SDL library initialized.
- Thread safety
- It is safe to call this function from any thread.
- C declaration
SDL_GetTicksNS, defined atSDL3/SDL_timer.h 213:36
Since: 3.2.0
sDL_GetPerformanceCounter :: IO Uint64 Source #
Get the current value of the high resolution counter.
This function is typically used for profiling.
The counter values are only meaningful relative to each other. Differences between values can be converted to times by using SDL_GetPerformanceFrequency().
- Returns
- the current counter value.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetPerformanceFrequency- C declaration
SDL_GetPerformanceCounter, defined atSDL3/SDL_timer.h 232:36
Since: 3.2.0
sDL_GetPerformanceFrequency :: IO Uint64 Source #
Get the count per second of the high resolution counter.
- Returns
- a platform-specific count per second.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_GetPerformanceCounter- C declaration
SDL_GetPerformanceFrequency, defined atSDL3/SDL_timer.h 245:36
Since: 3.2.0
Wait a specified number of milliseconds before returning.
This function waits a specified number of milliseconds before returning. It waits at least the specified time, but possibly longer due to OS scheduling.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_DelayNS,sDL_DelayPrecise- C declaration
SDL_Delay, defined atSDL3/SDL_timer.h 263:34
Since: 3.2.0
Wait a specified number of nanoseconds before returning.
This function waits a specified number of nanoseconds before returning. It waits at least the specified time, but possibly longer due to OS scheduling.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_Delay,sDL_DelayPrecise- C declaration
SDL_DelayNS, defined atSDL3/SDL_timer.h 281:34
Since: 3.2.0
Wait a specified number of nanoseconds before returning.
This function waits a specified number of nanoseconds before returning. It will attempt to wait as close to the requested time as possible, busy waiting if necessary, but could return later due to OS scheduling.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_Delay,sDL_DelayNS- C declaration
SDL_DelayPrecise, defined atSDL3/SDL_timer.h 299:34
Since: 3.2.0
Arguments
| :: Uint32 |
|
| -> SDL_TimerCallback |
|
| -> Ptr Void |
|
| -> IO SDL_TimerID |
Call a callback function at a future time.
The callback function is passed the current timer interval and the user supplied parameter from the SDL_AddTimer() call and should return the next timer interval. If the value returned from the callback is 0, the timer is canceled and will be removed.
The callback is run on a separate thread, and for short timeouts can potentially be called before this function returns.
Timers take into account the amount of time it took to execute the callback. For example, if the callback took 250 ms to execute and returned 1000 (ms), the timer would only wait another 750 ms before its next iteration.
Timing may be inexact due to OS scheduling. Be sure to note the current time with SDL_GetTicksNS() or SDL_GetPerformanceCounter() in case your callback needs to adjust for variances.
- Returns
- a timer ID or 0 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_AddTimerNS,sDL_RemoveTimer- C declaration
SDL_AddTimer, defined atSDL3/SDL_timer.h 368:41
Since: 3.2.0
Arguments
| :: Uint64 |
|
| -> SDL_NSTimerCallback |
|
| -> Ptr Void |
|
| -> IO SDL_TimerID |
Call a callback function at a future time.
The callback function is passed the current timer interval and the user supplied parameter from the SDL_AddTimerNS() call and should return the next timer interval. If the value returned from the callback is 0, the timer is canceled and will be removed.
The callback is run on a separate thread, and for short timeouts can potentially be called before this function returns.
Timers take into account the amount of time it took to execute the callback. For example, if the callback took 250 ns to execute and returned 1000 (ns), the timer would only wait another 750 ns before its next iteration.
Timing may be inexact due to OS scheduling. Be sure to note the current time with SDL_GetTicksNS() or SDL_GetPerformanceCounter() in case your callback needs to adjust for variances.
- Returns
- a timer ID or 0 on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_AddTimer,sDL_RemoveTimer- C declaration
SDL_AddTimerNS, defined atSDL3/SDL_timer.h 430:41
Since: 3.2.0
Arguments
| :: SDL_TimerID |
|
| -> IO CBool |
Remove a timer created with SDL_AddTimer().
- Returns
- true on success or false on failure; call SDL_GetError() for more information.
- Thread safety
- It is safe to call this function from any thread.
- See also
sDL_AddTimer- C declaration
SDL_RemoveTimer, defined atSDL3/SDL_timer.h 445:34
Since: 3.2.0