{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) A date and time. The date is assumed to be in the (proleptic) Gregorian calendar. The time is in UTC if @utc is %TRUE. Otherwise, the time is a local time, and @offset gives the offset from UTC in minutes (such that adding @offset to the time would give the correct UTC time). If @utc is %FALSE and @offset is 0, then the %SoupDate represents a "floating" time with no associated timezone information. -} module GI.Soup.Structs.Date ( -- * Exported types Date(..) , noDate , -- * Methods -- ** dateCopy dateCopy , -- ** dateFree dateFree , -- ** dateGetDay dateGetDay , -- ** dateGetHour dateGetHour , -- ** dateGetMinute dateGetMinute , -- ** dateGetMonth dateGetMonth , -- ** dateGetOffset dateGetOffset , -- ** dateGetSecond dateGetSecond , -- ** dateGetUtc dateGetUtc , -- ** dateGetYear dateGetYear , -- ** dateIsPast dateIsPast , -- ** dateNew dateNew , -- ** dateNewFromNow dateNewFromNow , -- ** dateNewFromString dateNewFromString , -- ** dateNewFromTimeT dateNewFromTimeT , -- ** dateToString dateToString , -- ** dateToTimeT dateToTimeT , -- ** dateToTimeval dateToTimeval , -- * Properties -- ** Day dateReadDay , -- ** Hour dateReadHour , -- ** Minute dateReadMinute , -- ** Month dateReadMonth , -- ** Offset dateReadOffset , -- ** Second dateReadSecond , -- ** Utc dateReadUtc , -- ** Year dateReadYear , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Soup.Types import GI.Soup.Callbacks import qualified GI.GLib as GLib newtype Date = Date (ForeignPtr Date) foreign import ccall "soup_date_get_type" c_soup_date_get_type :: IO GType instance BoxedObject Date where boxedType _ = c_soup_date_get_type noDate :: Maybe Date noDate = Nothing dateReadYear :: Date -> IO Int32 dateReadYear s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO Int32 return val dateReadMonth :: Date -> IO Int32 dateReadMonth s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 4) :: IO Int32 return val dateReadDay :: Date -> IO Int32 dateReadDay s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Int32 return val dateReadHour :: Date -> IO Int32 dateReadHour s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 12) :: IO Int32 return val dateReadMinute :: Date -> IO Int32 dateReadMinute s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 16) :: IO Int32 return val dateReadSecond :: Date -> IO Int32 dateReadSecond s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 20) :: IO Int32 return val dateReadUtc :: Date -> IO Bool dateReadUtc s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 24) :: IO CInt let val' = (/= 0) val return val' dateReadOffset :: Date -> IO Int32 dateReadOffset s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 28) :: IO Int32 return val -- method Date::new -- method type : Constructor -- Args : [Arg {argName = "year", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "month", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "day", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "hour", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "minute", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "second", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "year", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "month", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "day", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "hour", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "minute", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "second", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Soup" "Date" -- throws : False -- Skip return : False foreign import ccall "soup_date_new" soup_date_new :: Int32 -> -- year : TBasicType TInt32 Int32 -> -- month : TBasicType TInt32 Int32 -> -- day : TBasicType TInt32 Int32 -> -- hour : TBasicType TInt32 Int32 -> -- minute : TBasicType TInt32 Int32 -> -- second : TBasicType TInt32 IO (Ptr Date) dateNew :: (MonadIO m) => Int32 -> -- year Int32 -> -- month Int32 -> -- day Int32 -> -- hour Int32 -> -- minute Int32 -> -- second m Date dateNew year month day hour minute second = liftIO $ do result <- soup_date_new year month day hour minute second checkUnexpectedReturnNULL "soup_date_new" result result' <- (wrapBoxed Date) result return result' -- method Date::new_from_now -- method type : Constructor -- Args : [Arg {argName = "offset_seconds", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "offset_seconds", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Soup" "Date" -- throws : False -- Skip return : False foreign import ccall "soup_date_new_from_now" soup_date_new_from_now :: Int32 -> -- offset_seconds : TBasicType TInt32 IO (Ptr Date) dateNewFromNow :: (MonadIO m) => Int32 -> -- offset_seconds m Date dateNewFromNow offset_seconds = liftIO $ do result <- soup_date_new_from_now offset_seconds checkUnexpectedReturnNULL "soup_date_new_from_now" result result' <- (wrapBoxed Date) result return result' -- method Date::new_from_string -- method type : Constructor -- Args : [Arg {argName = "date_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "date_string", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Soup" "Date" -- throws : False -- Skip return : False foreign import ccall "soup_date_new_from_string" soup_date_new_from_string :: CString -> -- date_string : TBasicType TUTF8 IO (Ptr Date) dateNewFromString :: (MonadIO m) => T.Text -> -- date_string m Date dateNewFromString date_string = liftIO $ do date_string' <- textToCString date_string result <- soup_date_new_from_string date_string' checkUnexpectedReturnNULL "soup_date_new_from_string" result result' <- (wrapBoxed Date) result freeMem date_string' return result' -- method Date::new_from_time_t -- method type : Constructor -- Args : [Arg {argName = "when", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "when", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Soup" "Date" -- throws : False -- Skip return : False foreign import ccall "soup_date_new_from_time_t" soup_date_new_from_time_t :: Int64 -> -- when : TBasicType TInt64 IO (Ptr Date) dateNewFromTimeT :: (MonadIO m) => Int64 -> -- when m Date dateNewFromTimeT when_ = liftIO $ do result <- soup_date_new_from_time_t when_ checkUnexpectedReturnNULL "soup_date_new_from_time_t" result result' <- (wrapBoxed Date) result return result' -- method Date::copy -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Soup" "Date" -- throws : False -- Skip return : False foreign import ccall "soup_date_copy" soup_date_copy :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO (Ptr Date) dateCopy :: (MonadIO m) => Date -> -- _obj m Date dateCopy _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_copy _obj' checkUnexpectedReturnNULL "soup_date_copy" result result' <- (wrapBoxed Date) result touchManagedPtr _obj return result' -- method Date::free -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "soup_date_free" soup_date_free :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO () dateFree :: (MonadIO m) => Date -> -- _obj m () dateFree _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj soup_date_free _obj' touchManagedPtr _obj return () -- method Date::get_day -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "soup_date_get_day" soup_date_get_day :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int32 dateGetDay :: (MonadIO m) => Date -> -- _obj m Int32 dateGetDay _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_get_day _obj' touchManagedPtr _obj return result -- method Date::get_hour -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "soup_date_get_hour" soup_date_get_hour :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int32 dateGetHour :: (MonadIO m) => Date -> -- _obj m Int32 dateGetHour _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_get_hour _obj' touchManagedPtr _obj return result -- method Date::get_minute -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "soup_date_get_minute" soup_date_get_minute :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int32 dateGetMinute :: (MonadIO m) => Date -> -- _obj m Int32 dateGetMinute _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_get_minute _obj' touchManagedPtr _obj return result -- method Date::get_month -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "soup_date_get_month" soup_date_get_month :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int32 dateGetMonth :: (MonadIO m) => Date -> -- _obj m Int32 dateGetMonth _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_get_month _obj' touchManagedPtr _obj return result -- method Date::get_offset -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "soup_date_get_offset" soup_date_get_offset :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int32 dateGetOffset :: (MonadIO m) => Date -> -- _obj m Int32 dateGetOffset _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_get_offset _obj' touchManagedPtr _obj return result -- method Date::get_second -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "soup_date_get_second" soup_date_get_second :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int32 dateGetSecond :: (MonadIO m) => Date -> -- _obj m Int32 dateGetSecond _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_get_second _obj' touchManagedPtr _obj return result -- method Date::get_utc -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "soup_date_get_utc" soup_date_get_utc :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int32 dateGetUtc :: (MonadIO m) => Date -> -- _obj m Int32 dateGetUtc _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_get_utc _obj' touchManagedPtr _obj return result -- method Date::get_year -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "soup_date_get_year" soup_date_get_year :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int32 dateGetYear :: (MonadIO m) => Date -> -- _obj m Int32 dateGetYear _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_get_year _obj' touchManagedPtr _obj return result -- method Date::is_past -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "soup_date_is_past" soup_date_is_past :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO CInt dateIsPast :: (MonadIO m) => Date -> -- _obj m Bool dateIsPast _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_is_past _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method Date::to_string -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "format", argType = TInterface "Soup" "DateFormat", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "format", argType = TInterface "Soup" "DateFormat", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "soup_date_to_string" soup_date_to_string :: Ptr Date -> -- _obj : TInterface "Soup" "Date" CUInt -> -- format : TInterface "Soup" "DateFormat" IO CString dateToString :: (MonadIO m) => Date -> -- _obj DateFormat -> -- format m T.Text dateToString _obj format = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let format' = (fromIntegral . fromEnum) format result <- soup_date_to_string _obj' format' checkUnexpectedReturnNULL "soup_date_to_string" result result' <- cstringToText result freeMem result touchManagedPtr _obj return result' -- method Date::to_time_t -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt64 -- throws : False -- Skip return : False foreign import ccall "soup_date_to_time_t" soup_date_to_time_t :: Ptr Date -> -- _obj : TInterface "Soup" "Date" IO Int64 dateToTimeT :: (MonadIO m) => Date -> -- _obj m Int64 dateToTimeT _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- soup_date_to_time_t _obj' touchManagedPtr _obj return result -- method Date::to_timeval -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "time", argType = TInterface "GLib" "TimeVal", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Soup" "Date", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "soup_date_to_timeval" soup_date_to_timeval :: Ptr Date -> -- _obj : TInterface "Soup" "Date" Ptr GLib.TimeVal -> -- time : TInterface "GLib" "TimeVal" IO () dateToTimeval :: (MonadIO m) => Date -> -- _obj m (GLib.TimeVal) dateToTimeval _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj time <- callocBytes 16 :: IO (Ptr GLib.TimeVal) soup_date_to_timeval _obj' time time' <- (wrapPtr GLib.TimeVal) time touchManagedPtr _obj return time'