{-# LANGUAGE TypeApplications #-} -- | Copyright : Will Thompson and Iñaki García Etxebarria -- License : LGPL-2.1 -- Maintainer : Iñaki García Etxebarria -- -- A @GTimeZone@ represents a time zone, at no particular point in time. -- -- The @GTimeZone@ struct is refcounted and immutable. -- -- Each time zone has an identifier (for example, ‘Europe\/London’) which is -- platform dependent. See 'GI.GLib.Structs.TimeZone.timeZoneNew' for information on the -- identifier formats. The identifier of a time zone can be retrieved using -- 'GI.GLib.Structs.TimeZone.timeZoneGetIdentifier'. -- -- A time zone contains a number of intervals. Each interval has an abbreviation -- to describe it (for example, ‘PDT’), an offset to UTC and a flag indicating -- if the daylight savings time is in effect during that interval. A time zone -- always has at least one interval — interval 0. Note that interval abbreviations -- are not the same as time zone identifiers (apart from ‘UTC’), and cannot be -- passed to 'GI.GLib.Structs.TimeZone.timeZoneNew'. -- -- Every UTC time is contained within exactly one interval, but a given -- local time may be contained within zero, one or two intervals (due to -- incontinuities associated with daylight savings time). -- -- An interval may refer to a specific period of time (eg: the duration -- of daylight savings time during 2010) or it may refer to many periods -- of time that share the same properties (eg: all periods of daylight -- savings time). It is also possible (usually for political reasons) -- that some properties (like the abbreviation) change between intervals -- without other properties changing. -- -- /Since: 2.26/ #if !defined(__HADDOCK_VERSION__) #define ENABLE_OVERLOADING #endif module GI.GLib.Structs.TimeZone ( -- * Exported types TimeZone(..) , -- * Methods -- | -- -- === __Click to display all available methods, including inherited ones__ -- ==== Methods -- [adjustTime]("GI.GLib.Structs.TimeZone#g:method:adjustTime"), [findInterval]("GI.GLib.Structs.TimeZone#g:method:findInterval"), [isDst]("GI.GLib.Structs.TimeZone#g:method:isDst"), [ref]("GI.GLib.Structs.TimeZone#g:method:ref"), [unref]("GI.GLib.Structs.TimeZone#g:method:unref"). -- -- ==== Getters -- [getAbbreviation]("GI.GLib.Structs.TimeZone#g:method:getAbbreviation"), [getIdentifier]("GI.GLib.Structs.TimeZone#g:method:getIdentifier"), [getOffset]("GI.GLib.Structs.TimeZone#g:method:getOffset"). -- -- ==== Setters -- /None/. #if defined(ENABLE_OVERLOADING) ResolveTimeZoneMethod , #endif -- ** adjustTime #method:adjustTime# #if defined(ENABLE_OVERLOADING) TimeZoneAdjustTimeMethodInfo , #endif timeZoneAdjustTime , -- ** findInterval #method:findInterval# #if defined(ENABLE_OVERLOADING) TimeZoneFindIntervalMethodInfo , #endif timeZoneFindInterval , -- ** getAbbreviation #method:getAbbreviation# #if defined(ENABLE_OVERLOADING) TimeZoneGetAbbreviationMethodInfo , #endif timeZoneGetAbbreviation , -- ** getIdentifier #method:getIdentifier# #if defined(ENABLE_OVERLOADING) TimeZoneGetIdentifierMethodInfo , #endif timeZoneGetIdentifier , -- ** getOffset #method:getOffset# #if defined(ENABLE_OVERLOADING) TimeZoneGetOffsetMethodInfo , #endif timeZoneGetOffset , -- ** isDst #method:isDst# #if defined(ENABLE_OVERLOADING) TimeZoneIsDstMethodInfo , #endif timeZoneIsDst , -- ** new #method:new# timeZoneNew , -- ** newIdentifier #method:newIdentifier# timeZoneNewIdentifier , -- ** newLocal #method:newLocal# timeZoneNewLocal , -- ** newOffset #method:newOffset# timeZoneNewOffset , -- ** newUtc #method:newUtc# timeZoneNewUtc , -- ** ref #method:ref# #if defined(ENABLE_OVERLOADING) TimeZoneRefMethodInfo , #endif timeZoneRef , -- ** unref #method:unref# #if defined(ENABLE_OVERLOADING) TimeZoneUnrefMethodInfo , #endif timeZoneUnref , ) where import Data.GI.Base.ShortPrelude import qualified Data.GI.Base.ShortPrelude as SP import qualified Data.GI.Base.Overloading as O import qualified Prelude as P import qualified Data.GI.Base.Attributes as GI.Attributes import qualified Data.GI.Base.BasicTypes as B.Types import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr import qualified Data.GI.Base.GArray as B.GArray import qualified Data.GI.Base.GClosure as B.GClosure import qualified Data.GI.Base.GError as B.GError import qualified Data.GI.Base.GHashTable as B.GHT import qualified Data.GI.Base.GVariant as B.GVariant import qualified Data.GI.Base.GValue as B.GValue import qualified Data.GI.Base.GParamSpec as B.GParamSpec import qualified Data.GI.Base.CallStack as B.CallStack import qualified Data.GI.Base.Properties as B.Properties import qualified Data.GI.Base.Signals as B.Signals import qualified Control.Monad.IO.Class as MIO import qualified Data.Coerce as Coerce import qualified Data.Text as T import qualified Data.Kind as DK import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import qualified Foreign.Ptr as FP import qualified GHC.OverloadedLabels as OL import qualified GHC.Records as R import qualified Data.Word as DW import qualified Data.Int as DI import qualified System.Posix.Types as SPT import qualified Foreign.C.Types as FCT -- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392 #if MIN_VERSION_base(4,18,0) import {-# SOURCE #-} qualified GI.GLib.Enums as GLib.Enums #else import {-# SOURCE #-} qualified GI.GLib.Enums as GLib.Enums #endif -- | Memory-managed wrapper type. newtype TimeZone = TimeZone (SP.ManagedPtr TimeZone) deriving (TimeZone -> TimeZone -> Bool (TimeZone -> TimeZone -> Bool) -> (TimeZone -> TimeZone -> Bool) -> Eq TimeZone forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a $c== :: TimeZone -> TimeZone -> Bool == :: TimeZone -> TimeZone -> Bool $c/= :: TimeZone -> TimeZone -> Bool /= :: TimeZone -> TimeZone -> Bool Eq) instance SP.ManagedPtrNewtype TimeZone where toManagedPtr :: TimeZone -> ManagedPtr TimeZone toManagedPtr (TimeZone ManagedPtr TimeZone p) = ManagedPtr TimeZone p foreign import ccall "g_time_zone_get_type" c_g_time_zone_get_type :: IO GType type instance O.ParentTypes TimeZone = '[] instance O.HasParentTypes TimeZone instance B.Types.TypedObject TimeZone where glibType :: IO GType glibType = IO GType c_g_time_zone_get_type instance B.Types.GBoxed TimeZone -- | Convert t'TimeZone' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'. instance B.GValue.IsGValue (Maybe TimeZone) where gvalueGType_ :: IO GType gvalueGType_ = IO GType c_g_time_zone_get_type gvalueSet_ :: Ptr GValue -> Maybe TimeZone -> IO () gvalueSet_ Ptr GValue gv Maybe TimeZone P.Nothing = Ptr GValue -> Ptr TimeZone -> IO () forall a. Ptr GValue -> Ptr a -> IO () B.GValue.set_boxed Ptr GValue gv (Ptr TimeZone forall a. Ptr a FP.nullPtr :: FP.Ptr TimeZone) gvalueSet_ Ptr GValue gv (P.Just TimeZone obj) = TimeZone -> (Ptr TimeZone -> IO ()) -> IO () forall a c. (HasCallStack, ManagedPtrNewtype a) => a -> (Ptr a -> IO c) -> IO c B.ManagedPtr.withManagedPtr TimeZone obj (Ptr GValue -> Ptr TimeZone -> IO () forall a. Ptr GValue -> Ptr a -> IO () B.GValue.set_boxed Ptr GValue gv) gvalueGet_ :: Ptr GValue -> IO (Maybe TimeZone) gvalueGet_ Ptr GValue gv = do ptr <- Ptr GValue -> IO (Ptr TimeZone) forall b. Ptr GValue -> IO (Ptr b) B.GValue.get_boxed Ptr GValue gv :: IO (Ptr TimeZone) if ptr /= FP.nullPtr then P.Just <$> B.ManagedPtr.newBoxed TimeZone ptr else return P.Nothing #if defined(ENABLE_OVERLOADING) instance O.HasAttributeList TimeZone type instance O.AttributeList TimeZone = TimeZoneAttributeList type TimeZoneAttributeList = ('[ ] :: [(Symbol, DK.Type)]) #endif -- method TimeZone::new -- method type : Constructor -- Args: [ Arg -- { argCName = "identifier" -- , argType = TBasicType TUTF8 -- , argCType = Just "const gchar*" -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a timezone identifier" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "TimeZone" }) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_new" g_time_zone_new :: CString -> -- identifier : TBasicType TUTF8 IO (Ptr TimeZone) {-# DEPRECATED timeZoneNew ["(Since version 2.68)","Use 'GI.GLib.Structs.TimeZone.timeZoneNewIdentifier' instead, as it provides"," error reporting. Change your code to handle a potentially 'P.Nothing' return"," value."] #-} -- | A version of 'GI.GLib.Structs.TimeZone.timeZoneNewIdentifier' which returns the UTC time zone -- if /@identifier@/ could not be parsed or loaded. -- -- If you need to check whether /@identifier@/ was loaded successfully, use -- 'GI.GLib.Structs.TimeZone.timeZoneNewIdentifier'. -- -- /Since: 2.26/ timeZoneNew :: (B.CallStack.HasCallStack, MonadIO m) => Maybe (T.Text) -- ^ /@identifier@/: a timezone identifier -> m TimeZone -- ^ __Returns:__ the requested timezone timeZoneNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Maybe Text -> m TimeZone timeZoneNew Maybe Text identifier = IO TimeZone -> m TimeZone forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO TimeZone -> m TimeZone) -> IO TimeZone -> m TimeZone forall a b. (a -> b) -> a -> b $ do maybeIdentifier <- case Maybe Text identifier of Maybe Text Nothing -> Ptr CChar -> IO (Ptr CChar) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr CChar forall a. Ptr a FP.nullPtr Just Text jIdentifier -> do jIdentifier' <- Text -> IO (Ptr CChar) textToCString Text jIdentifier return jIdentifier' result <- g_time_zone_new maybeIdentifier checkUnexpectedReturnNULL "timeZoneNew" result result' <- (wrapBoxed TimeZone) result freeMem maybeIdentifier return result' #if defined(ENABLE_OVERLOADING) #endif -- method TimeZone::new_identifier -- method type : Constructor -- Args: [ Arg -- { argCName = "identifier" -- , argType = TBasicType TUTF8 -- , argCType = Just "const gchar*" -- , direction = DirectionIn -- , mayBeNull = True -- , argDoc = -- Documentation -- { rawDocText = Just "a timezone identifier" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "TimeZone" }) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_new_identifier" g_time_zone_new_identifier :: CString -> -- identifier : TBasicType TUTF8 IO (Ptr TimeZone) -- | Creates a t'GI.GLib.Structs.TimeZone.TimeZone' corresponding to /@identifier@/. If /@identifier@/ cannot be -- parsed or loaded, 'P.Nothing' is returned. -- -- /@identifier@/ can either be an RFC3339\/ISO 8601 time offset or -- something that would pass as a valid value for the @TZ@ environment -- variable (including 'P.Nothing'). -- -- In Windows, /@identifier@/ can also be the unlocalized name of a time -- zone for standard time, for example \"Pacific Standard Time\". -- -- Valid RFC3339 time offsets are @\"Z\"@ (for UTC) or -- @\"±hh:mm\"@. ISO 8601 additionally specifies -- @\"±hhmm\"@ and @\"±hh\"@. Offsets are -- time values to be added to Coordinated Universal Time (UTC) to get -- the local time. -- -- In UNIX, the @TZ@ environment variable typically corresponds -- to the name of a file in the zoneinfo database, an absolute path to a file -- somewhere else, or a string in -- \"std offset [dst [offset],start[\/time],end[\/time]]\" (POSIX) format. -- There are no spaces in the specification. The name of standard -- and daylight savings time zone must be three or more alphabetic -- characters. Offsets are time values to be added to local time to -- get Coordinated Universal Time (UTC) and should be -- @\"[±]hh[[:]mm[:ss]]\"@. Dates are either -- @\"Jn\"@ (Julian day with n between 1 and 365, leap -- years not counted), @\"n\"@ (zero-based Julian day -- with n between 0 and 365) or @\"Mm.w.d\"@ (day d -- (0 \<= d \<= 6) of week w (1 \<= w \<= 5) of month m (1 \<= m \<= 12), day -- 0 is a Sunday). Times are in local wall clock time, the default is -- 02:00:00. -- -- In Windows, the \"tzn[+|–]hh[:mm[:ss]][dzn]\" format is used, but also -- accepts POSIX format. The Windows format uses US rules for all time -- zones; daylight savings time is 60 minutes behind the standard time -- with date and time of change taken from Pacific Standard Time. -- Offsets are time values to be added to the local time to get -- Coordinated Universal Time (UTC). -- -- 'GI.GLib.Structs.TimeZone.timeZoneNewLocal' calls this function with the value of the -- @TZ@ environment variable. This function itself is independent of -- the value of @TZ@, but if /@identifier@/ is 'P.Nothing' then @\/etc\/localtime@ -- will be consulted to discover the correct time zone on UNIX and the -- registry will be consulted or @/GetTimeZoneInformation()/@ will be used -- to get the local time zone on Windows. -- -- If intervals are not available, only time zone rules from @TZ@ -- environment variable or other means, then they will be computed -- from year 1900 to 2037. If the maximum year for the rules is -- available and it is greater than 2037, then it will followed -- instead. -- -- See -- <http://tools.ietf.org/html/rfc3339#section-5.6 RFC3339 §5.6> -- for a precise definition of valid RFC3339 time offsets -- (the @time-offset@ expansion) and ISO 8601 for the -- full list of valid time offsets. See -- <http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html The GNU C Library manual> -- for an explanation of the possible -- values of the @TZ@ environment variable. See -- <http://msdn.microsoft.com/en-us/library/ms912391%28v=winembedded.11%29.aspx Microsoft Time Zone Index Values> -- for the list of time zones on Windows. -- -- You should release the return value by calling 'GI.GLib.Structs.TimeZone.timeZoneUnref' -- when you are done with it. -- -- /Since: 2.68/ timeZoneNewIdentifier :: (B.CallStack.HasCallStack, MonadIO m) => Maybe (T.Text) -- ^ /@identifier@/: a timezone identifier -> m (Maybe TimeZone) -- ^ __Returns:__ the requested timezone, or 'P.Nothing' on -- failure timeZoneNewIdentifier :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Maybe Text -> m (Maybe TimeZone) timeZoneNewIdentifier Maybe Text identifier = IO (Maybe TimeZone) -> m (Maybe TimeZone) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Maybe TimeZone) -> m (Maybe TimeZone)) -> IO (Maybe TimeZone) -> m (Maybe TimeZone) forall a b. (a -> b) -> a -> b $ do maybeIdentifier <- case Maybe Text identifier of Maybe Text Nothing -> Ptr CChar -> IO (Ptr CChar) forall a. a -> IO a forall (m :: * -> *) a. Monad m => a -> m a return Ptr CChar forall a. Ptr a FP.nullPtr Just Text jIdentifier -> do jIdentifier' <- Text -> IO (Ptr CChar) textToCString Text jIdentifier return jIdentifier' result <- g_time_zone_new_identifier maybeIdentifier maybeResult <- convertIfNonNull result $ \Ptr TimeZone result' -> do result'' <- ((ManagedPtr TimeZone -> TimeZone) -> Ptr TimeZone -> IO TimeZone forall a. (HasCallStack, GBoxed a) => (ManagedPtr a -> a) -> Ptr a -> IO a wrapBoxed ManagedPtr TimeZone -> TimeZone TimeZone) Ptr TimeZone result' return result'' freeMem maybeIdentifier return maybeResult #if defined(ENABLE_OVERLOADING) #endif -- method TimeZone::new_local -- method type : Constructor -- Args: [] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "TimeZone" }) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_new_local" g_time_zone_new_local :: IO (Ptr TimeZone) -- | Creates a t'GI.GLib.Structs.TimeZone.TimeZone' corresponding to local time. The local time -- zone may change between invocations to this function; for example, -- if the system administrator changes it. -- -- This is equivalent to calling 'GI.GLib.Structs.TimeZone.timeZoneNew' with the value of -- the @TZ@ environment variable (including the possibility of 'P.Nothing'). -- -- You should release the return value by calling 'GI.GLib.Structs.TimeZone.timeZoneUnref' -- when you are done with it. -- -- /Since: 2.26/ timeZoneNewLocal :: (B.CallStack.HasCallStack, MonadIO m) => m TimeZone -- ^ __Returns:__ the local timezone timeZoneNewLocal :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m TimeZone timeZoneNewLocal = IO TimeZone -> m TimeZone forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO TimeZone -> m TimeZone) -> IO TimeZone -> m TimeZone forall a b. (a -> b) -> a -> b $ do result <- IO (Ptr TimeZone) g_time_zone_new_local checkUnexpectedReturnNULL "timeZoneNewLocal" result result' <- (wrapBoxed TimeZone) result return result' #if defined(ENABLE_OVERLOADING) #endif -- method TimeZone::new_offset -- method type : Constructor -- Args: [ Arg -- { argCName = "seconds" -- , argType = TBasicType TInt32 -- , argCType = Just "gint32" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "offset to UTC, in seconds" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "TimeZone" }) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_new_offset" g_time_zone_new_offset :: Int32 -> -- seconds : TBasicType TInt32 IO (Ptr TimeZone) -- | Creates a t'GI.GLib.Structs.TimeZone.TimeZone' corresponding to the given constant offset from UTC, -- in seconds. -- -- This is equivalent to calling 'GI.GLib.Structs.TimeZone.timeZoneNew' with a string in the form -- @[+|-]hh[:mm[:ss]]@. -- -- It is possible for this function to fail if /@seconds@/ is too big (greater than -- 24 hours), in which case this function will return the UTC timezone for -- backwards compatibility. To detect failures like this, use -- 'GI.GLib.Structs.TimeZone.timeZoneNewIdentifier' directly. -- -- /Since: 2.58/ timeZoneNewOffset :: (B.CallStack.HasCallStack, MonadIO m) => Int32 -- ^ /@seconds@/: offset to UTC, in seconds -> m TimeZone -- ^ __Returns:__ a timezone at the given offset from UTC, or UTC on -- failure timeZoneNewOffset :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Int32 -> m TimeZone timeZoneNewOffset Int32 seconds = IO TimeZone -> m TimeZone forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO TimeZone -> m TimeZone) -> IO TimeZone -> m TimeZone forall a b. (a -> b) -> a -> b $ do result <- Int32 -> IO (Ptr TimeZone) g_time_zone_new_offset Int32 seconds checkUnexpectedReturnNULL "timeZoneNewOffset" result result' <- (wrapBoxed TimeZone) result return result' #if defined(ENABLE_OVERLOADING) #endif -- method TimeZone::new_utc -- method type : Constructor -- Args: [] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "TimeZone" }) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_new_utc" g_time_zone_new_utc :: IO (Ptr TimeZone) -- | Creates a t'GI.GLib.Structs.TimeZone.TimeZone' corresponding to UTC. -- -- This is equivalent to calling 'GI.GLib.Structs.TimeZone.timeZoneNew' with a value like -- \"Z\", \"UTC\", \"+00\", etc. -- -- You should release the return value by calling 'GI.GLib.Structs.TimeZone.timeZoneUnref' -- when you are done with it. -- -- /Since: 2.26/ timeZoneNewUtc :: (B.CallStack.HasCallStack, MonadIO m) => m TimeZone -- ^ __Returns:__ the universal timezone timeZoneNewUtc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m TimeZone timeZoneNewUtc = IO TimeZone -> m TimeZone forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO TimeZone -> m TimeZone) -> IO TimeZone -> m TimeZone forall a b. (a -> b) -> a -> b $ do result <- IO (Ptr TimeZone) g_time_zone_new_utc checkUnexpectedReturnNULL "timeZoneNewUtc" result result' <- (wrapBoxed TimeZone) result return result' #if defined(ENABLE_OVERLOADING) #endif -- method TimeZone::adjust_time -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "tz" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeZone" } -- , argCType = Just "GTimeZone*" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GTimeZone" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "type" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeType" } -- , argCType = Just "GTimeType" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the #GTimeType of @time_" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "time_" -- , argType = TBasicType TInt64 -- , argCType = Just "gint64*" -- , direction = DirectionInout -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = -- Just "a pointer to a number of seconds since January 1, 1970" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferEverything -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_adjust_time" g_time_zone_adjust_time :: Ptr TimeZone -> -- tz : TInterface (Name {namespace = "GLib", name = "TimeZone"}) CUInt -> -- type : TInterface (Name {namespace = "GLib", name = "TimeType"}) Ptr Int64 -> -- time_ : TBasicType TInt64 IO Int32 -- | Finds an interval within /@tz@/ that corresponds to the given /@time_@/, -- possibly adjusting /@time_@/ if required to fit into an interval. -- The meaning of /@time_@/ depends on /@type@/. -- -- This function is similar to 'GI.GLib.Structs.TimeZone.timeZoneFindInterval', with the -- difference that it always succeeds (by making the adjustments -- described below). -- -- In any of the cases where 'GI.GLib.Structs.TimeZone.timeZoneFindInterval' succeeds then -- this function returns the same value, without modifying /@time_@/. -- -- This function may, however, modify /@time_@/ in order to deal with -- non-existent times. If the non-existent local /@time_@/ of 02:30 were -- requested on March 14th 2010 in Toronto then this function would -- adjust /@time_@/ to be 03:00 and return the interval containing the -- adjusted time. -- -- /Since: 2.26/ timeZoneAdjustTime :: (B.CallStack.HasCallStack, MonadIO m) => TimeZone -- ^ /@tz@/: a t'GI.GLib.Structs.TimeZone.TimeZone' -> GLib.Enums.TimeType -- ^ /@type@/: the t'GI.GLib.Enums.TimeType' of /@time_@/ -> Int64 -- ^ /@time_@/: a pointer to a number of seconds since January 1, 1970 -> m ((Int32, Int64)) -- ^ __Returns:__ the interval containing /@time_@/, never -1 timeZoneAdjustTime :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TimeZone -> TimeType -> Int64 -> m (Int32, Int64) timeZoneAdjustTime TimeZone tz TimeType type_ Int64 time_ = IO (Int32, Int64) -> m (Int32, Int64) forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO (Int32, Int64) -> m (Int32, Int64)) -> IO (Int32, Int64) -> m (Int32, Int64) forall a b. (a -> b) -> a -> b $ do tz' <- TimeZone -> IO (Ptr TimeZone) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr TimeZone tz let type_' = (Int -> CUInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CUInt) -> (TimeType -> Int) -> TimeType -> CUInt forall b c a. (b -> c) -> (a -> b) -> a -> c . TimeType -> Int forall a. Enum a => a -> Int fromEnum) TimeType type_ time_' <- allocMem :: IO (Ptr Int64) poke time_' time_ result <- g_time_zone_adjust_time tz' type_' time_' time_'' <- peek time_' touchManagedPtr tz freeMem time_' return (result, time_'') #if defined(ENABLE_OVERLOADING) data TimeZoneAdjustTimeMethodInfo instance (signature ~ (GLib.Enums.TimeType -> Int64 -> m ((Int32, Int64))), MonadIO m) => O.OverloadedMethod TimeZoneAdjustTimeMethodInfo TimeZone signature where overloadedMethod = timeZoneAdjustTime instance O.OverloadedMethodInfo TimeZoneAdjustTimeMethodInfo TimeZone where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.TimeZone.timeZoneAdjustTime", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.30/docs/GI-GLib-Structs-TimeZone.html#v:timeZoneAdjustTime" }) #endif -- method TimeZone::find_interval -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "tz" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeZone" } -- , argCType = Just "GTimeZone*" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GTimeZone" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "type" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeType" } -- , argCType = Just "GTimeType" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "the #GTimeType of @time_" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "time_" -- , argType = TBasicType TInt64 -- , argCType = Just "gint64" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a number of seconds since January 1, 1970" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TInt) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_find_interval" g_time_zone_find_interval :: Ptr TimeZone -> -- tz : TInterface (Name {namespace = "GLib", name = "TimeZone"}) CUInt -> -- type : TInterface (Name {namespace = "GLib", name = "TimeType"}) Int64 -> -- time_ : TBasicType TInt64 IO Int32 -- | Finds an interval within /@tz@/ that corresponds to the given /@time_@/. -- The meaning of /@time_@/ depends on /@type@/. -- -- If /@type@/ is 'GI.GLib.Enums.TimeTypeUniversal' then this function will always -- succeed (since universal time is monotonic and continuous). -- -- Otherwise /@time_@/ is treated as local time. The distinction between -- 'GI.GLib.Enums.TimeTypeStandard' and 'GI.GLib.Enums.TimeTypeDaylight' is ignored except in -- the case that the given /@time_@/ is ambiguous. In Toronto, for example, -- 01:30 on November 7th 2010 occurred twice (once inside of daylight -- savings time and the next, an hour later, outside of daylight savings -- time). In this case, the different value of /@type@/ would result in a -- different interval being returned. -- -- It is still possible for this function to fail. In Toronto, for -- example, 02:00 on March 14th 2010 does not exist (due to the leap -- forward to begin daylight savings time). -1 is returned in that -- case. -- -- /Since: 2.26/ timeZoneFindInterval :: (B.CallStack.HasCallStack, MonadIO m) => TimeZone -- ^ /@tz@/: a t'GI.GLib.Structs.TimeZone.TimeZone' -> GLib.Enums.TimeType -- ^ /@type@/: the t'GI.GLib.Enums.TimeType' of /@time_@/ -> Int64 -- ^ /@time_@/: a number of seconds since January 1, 1970 -> m Int32 -- ^ __Returns:__ the interval containing /@time_@/, or -1 in case of failure timeZoneFindInterval :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TimeZone -> TimeType -> Int64 -> m Int32 timeZoneFindInterval TimeZone tz TimeType type_ Int64 time_ = IO Int32 -> m Int32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32 forall a b. (a -> b) -> a -> b $ do tz' <- TimeZone -> IO (Ptr TimeZone) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr TimeZone tz let type_' = (Int -> CUInt forall a b. (Integral a, Num b) => a -> b fromIntegral (Int -> CUInt) -> (TimeType -> Int) -> TimeType -> CUInt forall b c a. (b -> c) -> (a -> b) -> a -> c . TimeType -> Int forall a. Enum a => a -> Int fromEnum) TimeType type_ result <- g_time_zone_find_interval tz' type_' time_ touchManagedPtr tz return result #if defined(ENABLE_OVERLOADING) data TimeZoneFindIntervalMethodInfo instance (signature ~ (GLib.Enums.TimeType -> Int64 -> m Int32), MonadIO m) => O.OverloadedMethod TimeZoneFindIntervalMethodInfo TimeZone signature where overloadedMethod = timeZoneFindInterval instance O.OverloadedMethodInfo TimeZoneFindIntervalMethodInfo TimeZone where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.TimeZone.timeZoneFindInterval", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.30/docs/GI-GLib-Structs-TimeZone.html#v:timeZoneFindInterval" }) #endif -- method TimeZone::get_abbreviation -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "tz" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeZone" } -- , argCType = Just "GTimeZone*" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GTimeZone" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "interval" -- , argType = TBasicType TInt -- , argCType = Just "gint" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "an interval within the timezone" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_get_abbreviation" g_time_zone_get_abbreviation :: Ptr TimeZone -> -- tz : TInterface (Name {namespace = "GLib", name = "TimeZone"}) Int32 -> -- interval : TBasicType TInt IO CString -- | Determines the time zone abbreviation to be used during a particular -- /@interval@/ of time in the time zone /@tz@/. -- -- For example, in Toronto this is currently \"EST\" during the winter -- months and \"EDT\" during the summer months when daylight savings time -- is in effect. -- -- /Since: 2.26/ timeZoneGetAbbreviation :: (B.CallStack.HasCallStack, MonadIO m) => TimeZone -- ^ /@tz@/: a t'GI.GLib.Structs.TimeZone.TimeZone' -> Int32 -- ^ /@interval@/: an interval within the timezone -> m T.Text -- ^ __Returns:__ the time zone abbreviation, which belongs to /@tz@/ timeZoneGetAbbreviation :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TimeZone -> Int32 -> m Text timeZoneGetAbbreviation TimeZone tz Int32 interval = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do tz' <- TimeZone -> IO (Ptr TimeZone) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr TimeZone tz result <- g_time_zone_get_abbreviation tz' interval checkUnexpectedReturnNULL "timeZoneGetAbbreviation" result result' <- cstringToText result touchManagedPtr tz return result' #if defined(ENABLE_OVERLOADING) data TimeZoneGetAbbreviationMethodInfo instance (signature ~ (Int32 -> m T.Text), MonadIO m) => O.OverloadedMethod TimeZoneGetAbbreviationMethodInfo TimeZone signature where overloadedMethod = timeZoneGetAbbreviation instance O.OverloadedMethodInfo TimeZoneGetAbbreviationMethodInfo TimeZone where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.TimeZone.timeZoneGetAbbreviation", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.30/docs/GI-GLib-Structs-TimeZone.html#v:timeZoneGetAbbreviation" }) #endif -- method TimeZone::get_identifier -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "tz" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeZone" } -- , argCType = Just "GTimeZone*" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GTimeZone" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TUTF8) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_get_identifier" g_time_zone_get_identifier :: Ptr TimeZone -> -- tz : TInterface (Name {namespace = "GLib", name = "TimeZone"}) IO CString -- | Get the identifier of this t'GI.GLib.Structs.TimeZone.TimeZone', as passed to 'GI.GLib.Structs.TimeZone.timeZoneNew'. -- If the identifier passed at construction time was not recognised, @UTC@ will -- be returned. If it was 'P.Nothing', the identifier of the local timezone at -- construction time will be returned. -- -- The identifier will be returned in the same format as provided at -- construction time: if provided as a time offset, that will be returned by -- this function. -- -- /Since: 2.58/ timeZoneGetIdentifier :: (B.CallStack.HasCallStack, MonadIO m) => TimeZone -- ^ /@tz@/: a t'GI.GLib.Structs.TimeZone.TimeZone' -> m T.Text -- ^ __Returns:__ identifier for this timezone timeZoneGetIdentifier :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TimeZone -> m Text timeZoneGetIdentifier TimeZone tz = IO Text -> m Text forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Text -> m Text) -> IO Text -> m Text forall a b. (a -> b) -> a -> b $ do tz' <- TimeZone -> IO (Ptr TimeZone) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr TimeZone tz result <- g_time_zone_get_identifier tz' checkUnexpectedReturnNULL "timeZoneGetIdentifier" result result' <- cstringToText result touchManagedPtr tz return result' #if defined(ENABLE_OVERLOADING) data TimeZoneGetIdentifierMethodInfo instance (signature ~ (m T.Text), MonadIO m) => O.OverloadedMethod TimeZoneGetIdentifierMethodInfo TimeZone signature where overloadedMethod = timeZoneGetIdentifier instance O.OverloadedMethodInfo TimeZoneGetIdentifierMethodInfo TimeZone where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.TimeZone.timeZoneGetIdentifier", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.30/docs/GI-GLib-Structs-TimeZone.html#v:timeZoneGetIdentifier" }) #endif -- method TimeZone::get_offset -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "tz" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeZone" } -- , argCType = Just "GTimeZone*" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GTimeZone" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "interval" -- , argType = TBasicType TInt -- , argCType = Just "gint" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "an interval within the timezone" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TInt32) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_get_offset" g_time_zone_get_offset :: Ptr TimeZone -> -- tz : TInterface (Name {namespace = "GLib", name = "TimeZone"}) Int32 -> -- interval : TBasicType TInt IO Int32 -- | Determines the offset to UTC in effect during a particular /@interval@/ -- of time in the time zone /@tz@/. -- -- The offset is the number of seconds that you add to UTC time to -- arrive at local time for /@tz@/ (ie: negative numbers for time zones -- west of GMT, positive numbers for east). -- -- /Since: 2.26/ timeZoneGetOffset :: (B.CallStack.HasCallStack, MonadIO m) => TimeZone -- ^ /@tz@/: a t'GI.GLib.Structs.TimeZone.TimeZone' -> Int32 -- ^ /@interval@/: an interval within the timezone -> m Int32 -- ^ __Returns:__ the number of seconds that should be added to UTC to get the -- local time in /@tz@/ timeZoneGetOffset :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TimeZone -> Int32 -> m Int32 timeZoneGetOffset TimeZone tz Int32 interval = IO Int32 -> m Int32 forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32 forall a b. (a -> b) -> a -> b $ do tz' <- TimeZone -> IO (Ptr TimeZone) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr TimeZone tz result <- g_time_zone_get_offset tz' interval touchManagedPtr tz return result #if defined(ENABLE_OVERLOADING) data TimeZoneGetOffsetMethodInfo instance (signature ~ (Int32 -> m Int32), MonadIO m) => O.OverloadedMethod TimeZoneGetOffsetMethodInfo TimeZone signature where overloadedMethod = timeZoneGetOffset instance O.OverloadedMethodInfo TimeZoneGetOffsetMethodInfo TimeZone where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.TimeZone.timeZoneGetOffset", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.30/docs/GI-GLib-Structs-TimeZone.html#v:timeZoneGetOffset" }) #endif -- method TimeZone::is_dst -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "tz" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeZone" } -- , argCType = Just "GTimeZone*" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GTimeZone" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- , Arg -- { argCName = "interval" -- , argType = TBasicType TInt -- , argCType = Just "gint" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "an interval within the timezone" -- , sinceVersion = Nothing -- } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TBasicType TBoolean) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_is_dst" g_time_zone_is_dst :: Ptr TimeZone -> -- tz : TInterface (Name {namespace = "GLib", name = "TimeZone"}) Int32 -> -- interval : TBasicType TInt IO CInt -- | Determines if daylight savings time is in effect during a particular -- /@interval@/ of time in the time zone /@tz@/. -- -- /Since: 2.26/ timeZoneIsDst :: (B.CallStack.HasCallStack, MonadIO m) => TimeZone -- ^ /@tz@/: a t'GI.GLib.Structs.TimeZone.TimeZone' -> Int32 -- ^ /@interval@/: an interval within the timezone -> m Bool -- ^ __Returns:__ 'P.True' if daylight savings time is in effect timeZoneIsDst :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TimeZone -> Int32 -> m Bool timeZoneIsDst TimeZone tz Int32 interval = IO Bool -> m Bool forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool forall a b. (a -> b) -> a -> b $ do tz' <- TimeZone -> IO (Ptr TimeZone) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr TimeZone tz result <- g_time_zone_is_dst tz' interval let result' = (CInt -> CInt -> Bool forall a. Eq a => a -> a -> Bool /= CInt 0) CInt result touchManagedPtr tz return result' #if defined(ENABLE_OVERLOADING) data TimeZoneIsDstMethodInfo instance (signature ~ (Int32 -> m Bool), MonadIO m) => O.OverloadedMethod TimeZoneIsDstMethodInfo TimeZone signature where overloadedMethod = timeZoneIsDst instance O.OverloadedMethodInfo TimeZoneIsDstMethodInfo TimeZone where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.TimeZone.timeZoneIsDst", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.30/docs/GI-GLib-Structs-TimeZone.html#v:timeZoneIsDst" }) #endif -- method TimeZone::ref -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "tz" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeZone" } -- , argCType = Just "GTimeZone*" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GTimeZone" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Just (TInterface Name { namespace = "GLib" , name = "TimeZone" }) -- throws : False -- Skip return : False foreign import ccall "g_time_zone_ref" g_time_zone_ref :: Ptr TimeZone -> -- tz : TInterface (Name {namespace = "GLib", name = "TimeZone"}) IO (Ptr TimeZone) -- | Increases the reference count on /@tz@/. -- -- /Since: 2.26/ timeZoneRef :: (B.CallStack.HasCallStack, MonadIO m) => TimeZone -- ^ /@tz@/: a t'GI.GLib.Structs.TimeZone.TimeZone' -> m TimeZone -- ^ __Returns:__ a new reference to /@tz@/. timeZoneRef :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TimeZone -> m TimeZone timeZoneRef TimeZone tz = IO TimeZone -> m TimeZone forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO TimeZone -> m TimeZone) -> IO TimeZone -> m TimeZone forall a b. (a -> b) -> a -> b $ do tz' <- TimeZone -> IO (Ptr TimeZone) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr TimeZone tz result <- g_time_zone_ref tz' checkUnexpectedReturnNULL "timeZoneRef" result result' <- (wrapBoxed TimeZone) result touchManagedPtr tz return result' #if defined(ENABLE_OVERLOADING) data TimeZoneRefMethodInfo instance (signature ~ (m TimeZone), MonadIO m) => O.OverloadedMethod TimeZoneRefMethodInfo TimeZone signature where overloadedMethod = timeZoneRef instance O.OverloadedMethodInfo TimeZoneRefMethodInfo TimeZone where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.TimeZone.timeZoneRef", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.30/docs/GI-GLib-Structs-TimeZone.html#v:timeZoneRef" }) #endif -- method TimeZone::unref -- method type : OrdinaryMethod -- Args: [ Arg -- { argCName = "tz" -- , argType = -- TInterface Name { namespace = "GLib" , name = "TimeZone" } -- , argCType = Just "GTimeZone*" -- , direction = DirectionIn -- , mayBeNull = False -- , argDoc = -- Documentation -- { rawDocText = Just "a #GTimeZone" , sinceVersion = Nothing } -- , argScope = ScopeTypeInvalid -- , argClosure = -1 -- , argDestroy = -1 -- , argCallerAllocates = False -- , argCallbackUserData = False -- , transfer = TransferNothing -- } -- ] -- Lengths: [] -- returnType: Nothing -- throws : False -- Skip return : False foreign import ccall "g_time_zone_unref" g_time_zone_unref :: Ptr TimeZone -> -- tz : TInterface (Name {namespace = "GLib", name = "TimeZone"}) IO () -- | Decreases the reference count on /@tz@/. -- -- /Since: 2.26/ timeZoneUnref :: (B.CallStack.HasCallStack, MonadIO m) => TimeZone -- ^ /@tz@/: a t'GI.GLib.Structs.TimeZone.TimeZone' -> m () timeZoneUnref :: forall (m :: * -> *). (HasCallStack, MonadIO m) => TimeZone -> m () timeZoneUnref TimeZone tz = IO () -> m () forall a. IO a -> m a forall (m :: * -> *) a. MonadIO m => IO a -> m a liftIO (IO () -> m ()) -> IO () -> m () forall a b. (a -> b) -> a -> b $ do tz' <- TimeZone -> IO (Ptr TimeZone) forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a) unsafeManagedPtrGetPtr TimeZone tz g_time_zone_unref tz' touchManagedPtr tz return () #if defined(ENABLE_OVERLOADING) data TimeZoneUnrefMethodInfo instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod TimeZoneUnrefMethodInfo TimeZone signature where overloadedMethod = timeZoneUnref instance O.OverloadedMethodInfo TimeZoneUnrefMethodInfo TimeZone where overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo { O.resolvedSymbolName = "GI.GLib.Structs.TimeZone.timeZoneUnref", O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-glib-2.0.30/docs/GI-GLib-Structs-TimeZone.html#v:timeZoneUnref" }) #endif #if defined(ENABLE_OVERLOADING) type family ResolveTimeZoneMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where ResolveTimeZoneMethod "adjustTime" o = TimeZoneAdjustTimeMethodInfo ResolveTimeZoneMethod "findInterval" o = TimeZoneFindIntervalMethodInfo ResolveTimeZoneMethod "isDst" o = TimeZoneIsDstMethodInfo ResolveTimeZoneMethod "ref" o = TimeZoneRefMethodInfo ResolveTimeZoneMethod "unref" o = TimeZoneUnrefMethodInfo ResolveTimeZoneMethod "getAbbreviation" o = TimeZoneGetAbbreviationMethodInfo ResolveTimeZoneMethod "getIdentifier" o = TimeZoneGetIdentifierMethodInfo ResolveTimeZoneMethod "getOffset" o = TimeZoneGetOffsetMethodInfo ResolveTimeZoneMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveTimeZoneMethod t TimeZone, O.OverloadedMethod info TimeZone p) => OL.IsLabel t (TimeZone -> p) where #if MIN_VERSION_base(4,10,0) fromLabel = O.overloadedMethod @info #else fromLabel _ = O.overloadedMethod @info #endif #if MIN_VERSION_base(4,13,0) instance (info ~ ResolveTimeZoneMethod t TimeZone, O.OverloadedMethod info TimeZone p, R.HasField t TimeZone p) => R.HasField t TimeZone p where getField = O.overloadedMethod @info #endif instance (info ~ ResolveTimeZoneMethod t TimeZone, O.OverloadedMethodInfo info TimeZone) => OL.IsLabel t (O.MethodProxy info TimeZone) where #if MIN_VERSION_base(4,10,0) fromLabel = O.MethodProxy #else fromLabel _ = O.MethodProxy #endif #endif