{-# LANGUAGE NoImplicitPrelude #-}

-- | SDL realtime clock and date\/time routines.
--
--     There are two data types that are used in this category: SDL_Time, which represents the nanoseconds since a specific moment (an \"epoch\"), and 'SDL_DateTime', which breaks time down into human-understandable components: years, months, days, hours, etc.
--
--     Much of the functionality is involved in converting those two types to other useful forms. A structure holding a calendar date and time broken down into its components.
--
--     @since 3.2.0
--
--     == FFI conventions
--
--     Unsuffixed aliases are __unsafe__ foreign imports; aliases suffixed @Safe@ are safe. Functions whose callbacks fire during the call export only the Safe alias (the genuine unsafe import stays reachable under @SDL3.Sys.Bindgen.Time.Unsafe@); functions curated unsafe-only export only the unsuffixed one. Each alias\'s documentation records its flavor and rationale.
--
--     Full conventions: "SDL3.Sys".
module SDL3.Sys.Time (
  module SDL3.Sys.Bindgen.Time,

  -- * Function aliases
  SDL3.Sys.Time.getDateTimeLocalePreferences,
  SDL3.Sys.Time.getDateTimeLocalePreferencesSafe,
  SDL3.Sys.Time.getCurrentTime,
  SDL3.Sys.Time.getCurrentTimeSafe,
  SDL3.Sys.Time.timeToDateTime,
  SDL3.Sys.Time.timeToDateTimeSafe,
  SDL3.Sys.Time.dateTimeToTime,
  SDL3.Sys.Time.dateTimeToTimeSafe,
  SDL3.Sys.Time.timeToWindows,
  SDL3.Sys.Time.timeToWindowsSafe,
  SDL3.Sys.Time.timeFromWindows,
  SDL3.Sys.Time.timeFromWindowsSafe,
  SDL3.Sys.Time.getDaysInMonth,
  SDL3.Sys.Time.getDaysInMonthSafe,
  SDL3.Sys.Time.getDayOfYear,
  SDL3.Sys.Time.getDayOfYearSafe,
  SDL3.Sys.Time.getDayOfWeek,
  SDL3.Sys.Time.getDayOfWeekSafe,
)
where

import Data.Coerce qualified as Coerce
import Prelude (Bool, IO, fmap)

import HsBindgen.Runtime.CBool qualified as CBool
import HsBindgen.Runtime.LibC qualified
import HsBindgen.Runtime.PtrConst qualified as PtrConst
import HsBindgen.Runtime.Support qualified as BG
import SDL3.Sys.Bindgen.Stdinc qualified
import SDL3.Sys.Bindgen.Time
import SDL3.Sys.Bindgen.Time.Safe qualified as Safe
import SDL3.Sys.Bindgen.Time.Unsafe qualified as Unsafe

-- | Gets the current preferred date and time format for the system locale.
--
--     This might be a \"slow\" call that has to query the operating system. It\'s best to ask for this once and save the results. However, the preferred formats can change, usually because the user has changed a system preference outside of your program.
--
--     [Returns]: true on success or false on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: This function is not thread safe.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_GetDateTimeLocalePreferences@.
--                   The safe flavor is 'getDateTimeLocalePreferencesSafe'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetDateTimeLocalePreferences@, defined at @SDL3\/SDL_time.h 113:34@
getDateTimeLocalePreferences
  :: BG.Ptr SDL_DateFormat
  -- ^
  --
  --           [@dateFormat@]: a pointer to the 'SDL_DateFormat' to hold the returned date format, may be NULL.
  -> BG.Ptr SDL_TimeFormat
  -- ^
  --
  --           [@timeFormat@]: a pointer to the 'SDL_TimeFormat' to hold the returned time format, may be NULL.
  -> IO Bool
getDateTimeLocalePreferences :: Ptr SDL_DateFormat -> Ptr SDL_TimeFormat -> IO Bool
getDateTimeLocalePreferences =
  \Ptr SDL_DateFormat
x00 ->
    \Ptr SDL_TimeFormat
x11 ->
      (CBool -> Bool) -> IO CBool -> IO Bool
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CBool -> Bool
forall b. (Eq b, Num b) => b -> Bool
CBool.toBool (Ptr SDL_DateFormat -> Ptr SDL_TimeFormat -> IO CBool
Unsafe.sDL_GetDateTimeLocalePreferences Ptr SDL_DateFormat
x00 Ptr SDL_TimeFormat
x11)

-- | Gets the current preferred date and time format for the system locale.
--
--     This might be a \"slow\" call that has to query the operating system. It\'s best to ask for this once and save the results. However, the preferred formats can change, usually because the user has changed a system preference outside of your program.
--
--     [Returns]: true on success or false on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: This function is not thread safe.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_GetDateTimeLocalePreferences@.
--                   The unsafe flavor is 'getDateTimeLocalePreferences'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetDateTimeLocalePreferences@, defined at @SDL3\/SDL_time.h 113:34@
getDateTimeLocalePreferencesSafe
  :: BG.Ptr SDL_DateFormat
  -- ^
  --
  --           [@dateFormat@]: a pointer to the 'SDL_DateFormat' to hold the returned date format, may be NULL.
  -> BG.Ptr SDL_TimeFormat
  -- ^
  --
  --           [@timeFormat@]: a pointer to the 'SDL_TimeFormat' to hold the returned time format, may be NULL.
  -> IO Bool
getDateTimeLocalePreferencesSafe :: Ptr SDL_DateFormat -> Ptr SDL_TimeFormat -> IO Bool
getDateTimeLocalePreferencesSafe =
  \Ptr SDL_DateFormat
x00 ->
    \Ptr SDL_TimeFormat
x11 ->
      (CBool -> Bool) -> IO CBool -> IO Bool
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CBool -> Bool
forall b. (Eq b, Num b) => b -> Bool
CBool.toBool (Ptr SDL_DateFormat -> Ptr SDL_TimeFormat -> IO CBool
Safe.sDL_GetDateTimeLocalePreferences Ptr SDL_DateFormat
x00 Ptr SDL_TimeFormat
x11)

-- | Gets the current value of the system realtime clock in nanoseconds since Jan 1, 1970 in Universal Coordinated Time (UTC).
--
--     [Returns]: true on success or false on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_GetCurrentTime@.
--                   The safe flavor is 'getCurrentTimeSafe'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetCurrentTime@, defined at @SDL3\/SDL_time.h 127:34@
getCurrentTime
  :: BG.Ptr SDL3.Sys.Bindgen.Stdinc.SDL_Time
  -- ^
  --
  --           [@ticks@]: the SDL_Time to hold the returned tick count.
  -> IO Bool
getCurrentTime :: Ptr SDL_Time -> IO Bool
getCurrentTime =
  \Ptr SDL_Time
x00 ->
    (CBool -> Bool) -> IO CBool -> IO Bool
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CBool -> Bool
forall b. (Eq b, Num b) => b -> Bool
CBool.toBool (Ptr SDL_Time -> IO CBool
Unsafe.sDL_GetCurrentTime Ptr SDL_Time
x00)

-- | Gets the current value of the system realtime clock in nanoseconds since Jan 1, 1970 in Universal Coordinated Time (UTC).
--
--     [Returns]: true on success or false on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_GetCurrentTime@.
--                   The unsafe flavor is 'getCurrentTime'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetCurrentTime@, defined at @SDL3\/SDL_time.h 127:34@
getCurrentTimeSafe
  :: BG.Ptr SDL3.Sys.Bindgen.Stdinc.SDL_Time
  -- ^
  --
  --           [@ticks@]: the SDL_Time to hold the returned tick count.
  -> IO Bool
getCurrentTimeSafe :: Ptr SDL_Time -> IO Bool
getCurrentTimeSafe =
  \Ptr SDL_Time
x00 ->
    (CBool -> Bool) -> IO CBool -> IO Bool
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CBool -> Bool
forall b. (Eq b, Num b) => b -> Bool
CBool.toBool (Ptr SDL_Time -> IO CBool
Safe.sDL_GetCurrentTime Ptr SDL_Time
x00)

-- | Converts an SDL_Time in nanoseconds since the epoch to a calendar time in the 'SDL_DateTime' format.
--
--     [Returns]: true on success or false on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_TimeToDateTime@.
--                   The safe flavor is 'timeToDateTimeSafe'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_TimeToDateTime@, defined at @SDL3\/SDL_time.h 145:34@
timeToDateTime
  :: SDL3.Sys.Bindgen.Stdinc.SDL_Time
  -- ^
  --
  --           [@ticks@]: the SDL_Time to be converted.
  -> BG.Ptr SDL_DateTime
  -- ^
  --
  --           [@dt@]: the resulting 'SDL_DateTime'.
  -> Bool
  -- ^
  --
  --           [@localTime@]: the resulting 'SDL_DateTime' will be expressed in local time if true, otherwise it will be in Universal Coordinated Time (UTC).
  -> IO Bool
timeToDateTime :: SDL_Time -> Ptr SDL_DateTime -> Bool -> IO Bool
timeToDateTime =
  \SDL_Time
x00 ->
    \Ptr SDL_DateTime
x11 ->
      \Bool
x22 ->
        (CBool -> Bool) -> IO CBool -> IO Bool
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CBool -> Bool
forall b. (Eq b, Num b) => b -> Bool
CBool.toBool (SDL_Time -> Ptr SDL_DateTime -> CBool -> IO CBool
Unsafe.sDL_TimeToDateTime SDL_Time
x00 Ptr SDL_DateTime
x11 (Bool -> CBool
forall b. Num b => Bool -> b
CBool.fromBool Bool
x22))

-- | Converts an SDL_Time in nanoseconds since the epoch to a calendar time in the 'SDL_DateTime' format.
--
--     [Returns]: true on success or false on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_TimeToDateTime@.
--                   The unsafe flavor is 'timeToDateTime'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_TimeToDateTime@, defined at @SDL3\/SDL_time.h 145:34@
timeToDateTimeSafe
  :: SDL3.Sys.Bindgen.Stdinc.SDL_Time
  -- ^
  --
  --           [@ticks@]: the SDL_Time to be converted.
  -> BG.Ptr SDL_DateTime
  -- ^
  --
  --           [@dt@]: the resulting 'SDL_DateTime'.
  -> Bool
  -- ^
  --
  --           [@localTime@]: the resulting 'SDL_DateTime' will be expressed in local time if true, otherwise it will be in Universal Coordinated Time (UTC).
  -> IO Bool
timeToDateTimeSafe :: SDL_Time -> Ptr SDL_DateTime -> Bool -> IO Bool
timeToDateTimeSafe =
  \SDL_Time
x00 ->
    \Ptr SDL_DateTime
x11 ->
      \Bool
x22 ->
        (CBool -> Bool) -> IO CBool -> IO Bool
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CBool -> Bool
forall b. (Eq b, Num b) => b -> Bool
CBool.toBool (SDL_Time -> Ptr SDL_DateTime -> CBool -> IO CBool
Safe.sDL_TimeToDateTime SDL_Time
x00 Ptr SDL_DateTime
x11 (Bool -> CBool
forall b. Num b => Bool -> b
CBool.fromBool Bool
x22))

-- | Converts a calendar time to an SDL_Time in nanoseconds since the epoch.
--
--     This function ignores the day_of_week member of the 'SDL_DateTime' struct, so it may remain unset.
--
--     [Returns]: true on success or false on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_DateTimeToTime@.
--                   The safe flavor is 'dateTimeToTimeSafe'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_DateTimeToTime@, defined at @SDL3\/SDL_time.h 162:34@
dateTimeToTime
  :: PtrConst.PtrConst SDL_DateTime
  -- ^
  --
  --           [@dt@]: the source 'SDL_DateTime'.
  -> BG.Ptr SDL3.Sys.Bindgen.Stdinc.SDL_Time
  -- ^
  --
  --           [@ticks@]: the resulting SDL_Time.
  -> IO Bool
dateTimeToTime :: PtrConst SDL_DateTime -> Ptr SDL_Time -> IO Bool
dateTimeToTime =
  \PtrConst SDL_DateTime
x00 ->
    \Ptr SDL_Time
x11 ->
      (CBool -> Bool) -> IO CBool -> IO Bool
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CBool -> Bool
forall b. (Eq b, Num b) => b -> Bool
CBool.toBool (PtrConst SDL_DateTime -> Ptr SDL_Time -> IO CBool
Unsafe.sDL_DateTimeToTime PtrConst SDL_DateTime
x00 Ptr SDL_Time
x11)

-- | Converts a calendar time to an SDL_Time in nanoseconds since the epoch.
--
--     This function ignores the day_of_week member of the 'SDL_DateTime' struct, so it may remain unset.
--
--     [Returns]: true on success or false on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_DateTimeToTime@.
--                   The unsafe flavor is 'dateTimeToTime'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_DateTimeToTime@, defined at @SDL3\/SDL_time.h 162:34@
dateTimeToTimeSafe
  :: PtrConst.PtrConst SDL_DateTime
  -- ^
  --
  --           [@dt@]: the source 'SDL_DateTime'.
  -> BG.Ptr SDL3.Sys.Bindgen.Stdinc.SDL_Time
  -- ^
  --
  --           [@ticks@]: the resulting SDL_Time.
  -> IO Bool
dateTimeToTimeSafe :: PtrConst SDL_DateTime -> Ptr SDL_Time -> IO Bool
dateTimeToTimeSafe =
  \PtrConst SDL_DateTime
x00 ->
    \Ptr SDL_Time
x11 ->
      (CBool -> Bool) -> IO CBool -> IO Bool
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CBool -> Bool
forall b. (Eq b, Num b) => b -> Bool
CBool.toBool (PtrConst SDL_DateTime -> Ptr SDL_Time -> IO CBool
Safe.sDL_DateTimeToTime PtrConst SDL_DateTime
x00 Ptr SDL_Time
x11)

-- | Converts an SDL time into a Windows FILETIME (100-nanosecond intervals since January 1, 1601).
--
--     This function fills in the two 32-bit values of the FILETIME structure.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_TimeToWindows@.
--                   The safe flavor is 'timeToWindowsSafe'
--                   .
--
--     [C declaration]: @SDL_TimeToWindows@, defined at @SDL3\/SDL_time.h 180:34@
timeToWindows
  :: SDL3.Sys.Bindgen.Stdinc.SDL_Time
  -- ^
  --
  --           [@ticks@]: the time to convert.
  -> BG.Ptr SDL3.Sys.Bindgen.Stdinc.Uint32
  -- ^
  --
  --           [@dwLowDateTime@]: a pointer filled in with the low portion of the Windows FILETIME value.
  -> BG.Ptr SDL3.Sys.Bindgen.Stdinc.Uint32
  -- ^
  --
  --           [@dwHighDateTime@]: a pointer filled in with the high portion of the Windows FILETIME value.
  -> IO ()
timeToWindows :: SDL_Time -> Ptr Uint32 -> Ptr Uint32 -> IO ()
timeToWindows = SDL_Time -> Ptr Uint32 -> Ptr Uint32 -> IO ()
Unsafe.sDL_TimeToWindows

-- | Converts an SDL time into a Windows FILETIME (100-nanosecond intervals since January 1, 1601).
--
--     This function fills in the two 32-bit values of the FILETIME structure.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_TimeToWindows@.
--                   The unsafe flavor is 'timeToWindows'
--                   .
--
--     [C declaration]: @SDL_TimeToWindows@, defined at @SDL3\/SDL_time.h 180:34@
timeToWindowsSafe
  :: SDL3.Sys.Bindgen.Stdinc.SDL_Time
  -- ^
  --
  --           [@ticks@]: the time to convert.
  -> BG.Ptr SDL3.Sys.Bindgen.Stdinc.Uint32
  -- ^
  --
  --           [@dwLowDateTime@]: a pointer filled in with the low portion of the Windows FILETIME value.
  -> BG.Ptr SDL3.Sys.Bindgen.Stdinc.Uint32
  -- ^
  --
  --           [@dwHighDateTime@]: a pointer filled in with the high portion of the Windows FILETIME value.
  -> IO ()
timeToWindowsSafe :: SDL_Time -> Ptr Uint32 -> Ptr Uint32 -> IO ()
timeToWindowsSafe = SDL_Time -> Ptr Uint32 -> Ptr Uint32 -> IO ()
Safe.sDL_TimeToWindows

-- | Converts a Windows FILETIME (100-nanosecond intervals since January 1, 1601) to an SDL time.
--
--     This function takes the two 32-bit values of the FILETIME structure as parameters.
--
--     [Returns]: the converted SDL time.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_TimeFromWindows@.
--                   The safe flavor is 'timeFromWindowsSafe'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_TimeFromWindows@, defined at @SDL3\/SDL_time.h 197:38@
timeFromWindows
  :: BG.Word32
  -- ^
  --
  --           [@dwLowDateTime@]: the low portion of the Windows FILETIME value.
  -> BG.Word32
  -- ^
  --
  --           [@dwHighDateTime@]: the high portion of the Windows FILETIME value.
  -> IO SDL3.Sys.Bindgen.Stdinc.SDL_Time
timeFromWindows :: Word32 -> Word32 -> IO SDL_Time
timeFromWindows =
  \Word32
x00 ->
    \Word32
x11 ->
      Uint32 -> Uint32 -> IO SDL_Time
Unsafe.sDL_TimeFromWindows (Word32 -> Uint32
forall a b. Coercible a b => a -> b
Coerce.coerce Word32
x00) (Word32 -> Uint32
forall a b. Coercible a b => a -> b
Coerce.coerce Word32
x11)

-- | Converts a Windows FILETIME (100-nanosecond intervals since January 1, 1601) to an SDL time.
--
--     This function takes the two 32-bit values of the FILETIME structure as parameters.
--
--     [Returns]: the converted SDL time.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_TimeFromWindows@.
--                   The unsafe flavor is 'timeFromWindows'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_TimeFromWindows@, defined at @SDL3\/SDL_time.h 197:38@
timeFromWindowsSafe
  :: BG.Word32
  -- ^
  --
  --           [@dwLowDateTime@]: the low portion of the Windows FILETIME value.
  -> BG.Word32
  -- ^
  --
  --           [@dwHighDateTime@]: the high portion of the Windows FILETIME value.
  -> IO SDL3.Sys.Bindgen.Stdinc.SDL_Time
timeFromWindowsSafe :: Word32 -> Word32 -> IO SDL_Time
timeFromWindowsSafe =
  \Word32
x00 ->
    \Word32
x11 ->
      Uint32 -> Uint32 -> IO SDL_Time
Safe.sDL_TimeFromWindows (Word32 -> Uint32
forall a b. Coercible a b => a -> b
Coerce.coerce Word32
x00) (Word32 -> Uint32
forall a b. Coercible a b => a -> b
Coerce.coerce Word32
x11)

-- | Get the number of days in a month for a given year.
--
--     [Returns]: the number of days in the requested month or -1 on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_GetDaysInMonth@.
--                   The safe flavor is 'getDaysInMonthSafe'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetDaysInMonth@, defined at @SDL3\/SDL_time.h 211:33@
getDaysInMonth
  :: BG.Int32
  -- ^
  --
  --           [@year@]: the year.
  -> BG.Int32
  -- ^
  --
  --           [@month@]: the month [1-12].
  -> IO BG.Int32
getDaysInMonth :: Int32 -> Int32 -> IO Int32
getDaysInMonth =
  \Int32
x00 ->
    \Int32
x11 ->
      (CInt -> Int32) -> IO CInt -> IO Int32
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CInt -> Int32
forall a b. Coercible a b => a -> b
Coerce.coerce (CInt -> CInt -> IO CInt
Unsafe.sDL_GetDaysInMonth (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x00) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x11))

-- | Get the number of days in a month for a given year.
--
--     [Returns]: the number of days in the requested month or -1 on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_GetDaysInMonth@.
--                   The unsafe flavor is 'getDaysInMonth'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetDaysInMonth@, defined at @SDL3\/SDL_time.h 211:33@
getDaysInMonthSafe
  :: BG.Int32
  -- ^
  --
  --           [@year@]: the year.
  -> BG.Int32
  -- ^
  --
  --           [@month@]: the month [1-12].
  -> IO BG.Int32
getDaysInMonthSafe :: Int32 -> Int32 -> IO Int32
getDaysInMonthSafe =
  \Int32
x00 ->
    \Int32
x11 ->
      (CInt -> Int32) -> IO CInt -> IO Int32
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CInt -> Int32
forall a b. Coercible a b => a -> b
Coerce.coerce (CInt -> CInt -> IO CInt
Safe.sDL_GetDaysInMonth (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x00) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x11))

-- | Get the day of year for a calendar date.
--
--     [Returns]: the day of year [0-365] if the date is valid or -1 on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_GetDayOfYear@.
--                   The safe flavor is 'getDayOfYearSafe'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetDayOfYear@, defined at @SDL3\/SDL_time.h 226:33@
getDayOfYear
  :: BG.Int32
  -- ^
  --
  --           [@year@]: the year component of the date.
  -> BG.Int32
  -- ^
  --
  --           [@month@]: the month component of the date.
  -> BG.Int32
  -- ^
  --
  --           [@day@]: the day component of the date.
  -> IO BG.Int32
getDayOfYear :: Int32 -> Int32 -> Int32 -> IO Int32
getDayOfYear =
  \Int32
x00 ->
    \Int32
x11 ->
      \Int32
x22 ->
        (CInt -> Int32) -> IO CInt -> IO Int32
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
          CInt -> Int32
forall a b. Coercible a b => a -> b
Coerce.coerce
          (CInt -> CInt -> CInt -> IO CInt
Unsafe.sDL_GetDayOfYear (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x00) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x11) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x22))

-- | Get the day of year for a calendar date.
--
--     [Returns]: the day of year [0-365] if the date is valid or -1 on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_GetDayOfYear@.
--                   The unsafe flavor is 'getDayOfYear'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetDayOfYear@, defined at @SDL3\/SDL_time.h 226:33@
getDayOfYearSafe
  :: BG.Int32
  -- ^
  --
  --           [@year@]: the year component of the date.
  -> BG.Int32
  -- ^
  --
  --           [@month@]: the month component of the date.
  -> BG.Int32
  -- ^
  --
  --           [@day@]: the day component of the date.
  -> IO BG.Int32
getDayOfYearSafe :: Int32 -> Int32 -> Int32 -> IO Int32
getDayOfYearSafe =
  \Int32
x00 ->
    \Int32
x11 ->
      \Int32
x22 ->
        (CInt -> Int32) -> IO CInt -> IO Int32
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
          CInt -> Int32
forall a b. Coercible a b => a -> b
Coerce.coerce
          (CInt -> CInt -> CInt -> IO CInt
Safe.sDL_GetDayOfYear (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x00) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x11) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x22))

-- | Get the day of week for a calendar date.
--
--     [Returns]: a value between 0 and 6 (0 being Sunday) if the date is valid or -1 on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Unsafe__ foreign import of @SDL_GetDayOfWeek@.
--                   The safe flavor is 'getDayOfWeekSafe'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetDayOfWeek@, defined at @SDL3\/SDL_time.h 241:33@
getDayOfWeek
  :: BG.Int32
  -- ^
  --
  --           [@year@]: the year component of the date.
  -> BG.Int32
  -- ^
  --
  --           [@month@]: the month component of the date.
  -> BG.Int32
  -- ^
  --
  --           [@day@]: the day component of the date.
  -> IO BG.Int32
getDayOfWeek :: Int32 -> Int32 -> Int32 -> IO Int32
getDayOfWeek =
  \Int32
x00 ->
    \Int32
x11 ->
      \Int32
x22 ->
        (CInt -> Int32) -> IO CInt -> IO Int32
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
          CInt -> Int32
forall a b. Coercible a b => a -> b
Coerce.coerce
          (CInt -> CInt -> CInt -> IO CInt
Unsafe.sDL_GetDayOfWeek (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x00) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x11) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x22))

-- | Get the day of week for a calendar date.
--
--     [Returns]: a value between 0 and 6 (0 being Sunday) if the date is valid or -1 on failure; call 'SDL3.Sys.Error.getError' for more information.
--
--     [Thread safety]: It is safe to call this function from any thread.
--
--     @since 3.2.0
--
--     === __@sdl3-bindgen-sys@ notes__
--
--     [FFI safety]: __Safe__ foreign import of @SDL_GetDayOfWeek@.
--                   The unsafe flavor is 'getDayOfWeek'
--                   .
--
--     [Scalars]: The binding generation has mapped C scalars to native Haskell scalars for this function.
--                Pointers and structs are untouched by this best-effort mapping. Higher-level bindings are expected to map structs and pointers as appropriate.
--
--     [C declaration]: @SDL_GetDayOfWeek@, defined at @SDL3\/SDL_time.h 241:33@
getDayOfWeekSafe
  :: BG.Int32
  -- ^
  --
  --           [@year@]: the year component of the date.
  -> BG.Int32
  -- ^
  --
  --           [@month@]: the month component of the date.
  -> BG.Int32
  -- ^
  --
  --           [@day@]: the day component of the date.
  -> IO BG.Int32
getDayOfWeekSafe :: Int32 -> Int32 -> Int32 -> IO Int32
getDayOfWeekSafe =
  \Int32
x00 ->
    \Int32
x11 ->
      \Int32
x22 ->
        (CInt -> Int32) -> IO CInt -> IO Int32
forall a b. (a -> b) -> IO a -> IO b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
          CInt -> Int32
forall a b. Coercible a b => a -> b
Coerce.coerce
          (CInt -> CInt -> CInt -> IO CInt
Safe.sDL_GetDayOfWeek (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x00) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x11) (Int32 -> CInt
forall a b. Coercible a b => a -> b
Coerce.coerce Int32
x22))