gi-soup-2.4.29: Libsoup bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Soup.Structs.Date

Description

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.

Synopsis

Exported types

newtype Date Source #

Memory-managed wrapper type.

Constructors

Date (ManagedPtr Date) 

Instances

Instances details
Eq Date Source # 
Instance details

Defined in GI.Soup.Structs.Date

Methods

(==) :: Date -> Date -> Bool #

(/=) :: Date -> Date -> Bool #

GBoxed Date Source # 
Instance details

Defined in GI.Soup.Structs.Date

ManagedPtrNewtype Date Source # 
Instance details

Defined in GI.Soup.Structs.Date

Methods

toManagedPtr :: Date -> ManagedPtr Date

TypedObject Date Source # 
Instance details

Defined in GI.Soup.Structs.Date

Methods

glibType :: IO GType

HasParentTypes Date Source # 
Instance details

Defined in GI.Soup.Structs.Date

tag ~ 'AttrSet => Constructible Date tag Source # 
Instance details

Defined in GI.Soup.Structs.Date

Methods

new :: MonadIO m => (ManagedPtr Date -> Date) -> [AttrOp Date tag] -> m Date

IsGValue (Maybe Date) Source #

Convert Date to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Soup.Structs.Date

Methods

gvalueGType_ :: IO GType

gvalueSet_ :: Ptr GValue -> Maybe Date -> IO ()

gvalueGet_ :: Ptr GValue -> IO (Maybe Date)

type ParentTypes Date Source # 
Instance details

Defined in GI.Soup.Structs.Date

type ParentTypes Date = '[] :: [Type]

newZeroDate :: MonadIO m => m Date Source #

Construct a Date struct initialized to zero.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

copy, free, isPast, toString, toTimeT, toTimeval.

Getters

getDay, getHour, getMinute, getMonth, getOffset, getSecond, getUtc, getYear.

Setters

None.

copy

dateCopy Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Date 

Copies date.

Since: 2.24

free

dateFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m () 

Frees date.

Since: 2.24

getDay

dateGetDay Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Int32

Returns: date's day

Gets date's day.

Since: 2.32

getHour

dateGetHour Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Int32

Returns: date's hour

Gets date's hour.

Since: 2.32

getMinute

dateGetMinute Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Int32

Returns: date's minute

Gets date's minute.

Since: 2.32

getMonth

dateGetMonth Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Int32

Returns: date's month

Gets date's month.

Since: 2.32

getOffset

dateGetOffset Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Int32

Returns: date's offset from UTC. If dateGetUtc returns False but dateGetOffset returns 0, that means the date is a "floating" time with no associated offset information.

Gets date's offset from UTC.

Since: 2.32

getSecond

dateGetSecond Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Int32

Returns: date's second

Gets date's second.

Since: 2.32

getUtc

dateGetUtc Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Int32

Returns: True if date is UTC.

Gets date's UTC flag

Since: 2.32

getYear

dateGetYear Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Int32

Returns: date's year

Gets date's year.

Since: 2.32

isPast

dateIsPast Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m Bool

Returns: True if date is in the past

Determines if date is in the past.

Since: 2.24

new

dateNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

year: the year (1-9999)

-> Int32

month: the month (1-12)

-> Int32

day: the day of the month (1-31, as appropriate for month)

-> Int32

hour: the hour (0-23)

-> Int32

minute: the minute (0-59)

-> Int32

second: the second (0-59, or up to 61 for leap seconds)

-> m Date

Returns: a new Date

Creates a Date representing the indicated time, UTC.

newFromNow

dateNewFromNow Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Int32

offsetSeconds: offset from current time

-> m Date

Returns: a new Date

Creates a Date representing a time offsetSeconds after the current time (or before it, if offsetSeconds is negative). If offset_seconds is 0, returns the current time.

If offsetSeconds would indicate a time not expressible as a <type>time_t</type>, the return value will be clamped into range.

newFromString

dateNewFromString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

dateString: the date in some plausible format

-> m (Maybe Date)

Returns: a new Date, or Nothing if dateString could not be parsed.

Parses dateString and tries to extract a date from it. This recognizes all of the "HTTP-date" formats from RFC 2616, all ISO 8601 formats containing both a time and a date, RFC 2822 dates, and reasonable approximations thereof. (Eg, it is lenient about whitespace, leading "0"s, etc.)

newFromTimeT

dateNewFromTimeT Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> CLong

when: a <type>time_t</type>

-> m Date

Returns: a new Date

Creates a Date corresponding to when

toString

dateToString Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> DateFormat

format: the format to generate the date in

-> m Text

Returns: date as a string

Converts date to a string in the format described by format.

toTimeT

dateToTimeT Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m CLong

Returns: date as a <type>time_t</type>

Converts date to a <type>time_t</type>, assumming it to be in UTC.

If date is not representable as a <type>time_t</type>, it will be clamped into range. (In particular, some HTTP cookies have expiration dates after "Y2.038k" (2038-01-19T03:14:07Z).)

toTimeval

dateToTimeval Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Date

date: a Date

-> m TimeVal 

Deprecated: Do not use TimeVal, as it's not Y2038-safe.

Converts date to a TimeVal.

Since: 2.24

Properties

day

day of the month, 1 to 31

getDateDay :: MonadIO m => Date -> m Int32 Source #

Get the value of the “day” field. When overloading is enabled, this is equivalent to

get date #day

setDateDay :: MonadIO m => Date -> Int32 -> m () Source #

Set the value of the “day” field. When overloading is enabled, this is equivalent to

set date [ #day := value ]

hour

hour of the day, 0 to 23

getDateHour :: MonadIO m => Date -> m Int32 Source #

Get the value of the “hour” field. When overloading is enabled, this is equivalent to

get date #hour

setDateHour :: MonadIO m => Date -> Int32 -> m () Source #

Set the value of the “hour” field. When overloading is enabled, this is equivalent to

set date [ #hour := value ]

minute

minute, 0 to 59

getDateMinute :: MonadIO m => Date -> m Int32 Source #

Get the value of the “minute” field. When overloading is enabled, this is equivalent to

get date #minute

setDateMinute :: MonadIO m => Date -> Int32 -> m () Source #

Set the value of the “minute” field. When overloading is enabled, this is equivalent to

set date [ #minute := value ]

month

the month, 1 to 12

getDateMonth :: MonadIO m => Date -> m Int32 Source #

Get the value of the “month” field. When overloading is enabled, this is equivalent to

get date #month

setDateMonth :: MonadIO m => Date -> Int32 -> m () Source #

Set the value of the “month” field. When overloading is enabled, this is equivalent to

set date [ #month := value ]

offset

offset from UTC

getDateOffset :: MonadIO m => Date -> m Int32 Source #

Get the value of the “offset” field. When overloading is enabled, this is equivalent to

get date #offset

setDateOffset :: MonadIO m => Date -> Int32 -> m () Source #

Set the value of the “offset” field. When overloading is enabled, this is equivalent to

set date [ #offset := value ]

second

second, 0 to 59 (or up to 61 in the case of leap seconds)

getDateSecond :: MonadIO m => Date -> m Int32 Source #

Get the value of the “second” field. When overloading is enabled, this is equivalent to

get date #second

setDateSecond :: MonadIO m => Date -> Int32 -> m () Source #

Set the value of the “second” field. When overloading is enabled, this is equivalent to

set date [ #second := value ]

utc

True if the date is in UTC

getDateUtc :: MonadIO m => Date -> m Bool Source #

Get the value of the “utc” field. When overloading is enabled, this is equivalent to

get date #utc

setDateUtc :: MonadIO m => Date -> Bool -> m () Source #

Set the value of the “utc” field. When overloading is enabled, this is equivalent to

set date [ #utc := value ]

year

the year, 1 to 9999

getDateYear :: MonadIO m => Date -> m Int32 Source #

Get the value of the “year” field. When overloading is enabled, this is equivalent to

get date #year

setDateYear :: MonadIO m => Date -> Int32 -> m () Source #

Set the value of the “year” field. When overloading is enabled, this is equivalent to

set date [ #year := value ]