Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
TimeZone
is an opaque structure whose members cannot be accessed
directly.
Since: 2.26
Synopsis
- newtype TimeZone = TimeZone (ManagedPtr TimeZone)
- timeZoneAdjustTime :: (HasCallStack, MonadIO m) => TimeZone -> TimeType -> Int64 -> m Int32
- timeZoneFindInterval :: (HasCallStack, MonadIO m) => TimeZone -> TimeType -> Int64 -> m Int32
- timeZoneGetAbbreviation :: (HasCallStack, MonadIO m) => TimeZone -> Int32 -> m Text
- timeZoneGetIdentifier :: (HasCallStack, MonadIO m) => TimeZone -> m Text
- timeZoneGetOffset :: (HasCallStack, MonadIO m) => TimeZone -> Int32 -> m Int32
- timeZoneIsDst :: (HasCallStack, MonadIO m) => TimeZone -> Int32 -> m Bool
- timeZoneNew :: (HasCallStack, MonadIO m) => Maybe Text -> m TimeZone
- timeZoneNewLocal :: (HasCallStack, MonadIO m) => m TimeZone
- timeZoneNewOffset :: (HasCallStack, MonadIO m) => Int32 -> m TimeZone
- timeZoneNewUtc :: (HasCallStack, MonadIO m) => m TimeZone
- timeZoneRef :: (HasCallStack, MonadIO m) => TimeZone -> m TimeZone
- timeZoneUnref :: (HasCallStack, MonadIO m) => TimeZone -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq TimeZone Source # | |
IsGValue TimeZone Source # | Convert |
ManagedPtrNewtype TimeZone Source # | |
Defined in GI.GLib.Structs.TimeZone toManagedPtr :: TimeZone -> ManagedPtr TimeZone # | |
TypedObject TimeZone Source # | |
Defined in GI.GLib.Structs.TimeZone | |
GBoxed TimeZone Source # | |
Defined in GI.GLib.Structs.TimeZone | |
HasParentTypes TimeZone Source # | |
Defined in GI.GLib.Structs.TimeZone | |
type ParentTypes TimeZone Source # | |
Defined in GI.GLib.Structs.TimeZone |
Methods
Overloaded methods
adjustTime
:: (HasCallStack, MonadIO m) | |
=> TimeZone |
|
-> TimeType |
|
-> Int64 |
|
-> m Int32 | Returns: the interval containing |
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 timeZoneFindInterval
, with the
difference that it always succeeds (by making the adjustments
described below).
In any of the cases where 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
findInterval
:: (HasCallStack, MonadIO m) | |
=> TimeZone |
|
-> TimeType |
|
-> Int64 |
|
-> m Int32 | Returns: the interval containing |
Finds an interval within tz
that corresponds to the given time_
.
The meaning of time_
depends on type
.
If type
is TimeTypeUniversal
then this function will always
succeed (since universal time is monotonic and continuous).
Otherwise time_
is treated as local time. The distinction between
TimeTypeStandard
and 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
getAbbreviation
timeZoneGetAbbreviation Source #
:: (HasCallStack, MonadIO m) | |
=> TimeZone |
|
-> Int32 |
|
-> m Text | Returns: the time zone abbreviation, which belongs to |
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
getIdentifier
timeZoneGetIdentifier Source #
:: (HasCallStack, MonadIO m) | |
=> TimeZone |
|
-> m Text | Returns: identifier for this timezone |
Get the identifier of this TimeZone
, as passed to timeZoneNew
.
If the identifier passed at construction time was not recognised, UTC
will
be returned. If it was 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
getOffset
:: (HasCallStack, MonadIO m) | |
=> TimeZone |
|
-> Int32 |
|
-> m Int32 | Returns: the number of seconds that should be added to UTC to get the
local time in |
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
isDst
:: (HasCallStack, MonadIO m) | |
=> TimeZone |
|
-> Int32 |
|
-> m Bool | Returns: |
Determines if daylight savings time is in effect during a particular
interval
of time in the time zone tz
.
Since: 2.26
new
:: (HasCallStack, MonadIO m) | |
=> Maybe Text |
|
-> m TimeZone | Returns: the requested timezone |
Creates a TimeZone
corresponding to identifier
.
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 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).
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 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
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
The GNU C Library manual
for an explanation of the possible
values of the TZ
environment variable. See
Microsoft Time Zone Index Values
for the list of time zones on Windows.
You should release the return value by calling timeZoneUnref
when you are done with it.
Since: 2.26
newLocal
:: (HasCallStack, MonadIO m) | |
=> m TimeZone | Returns: the local timezone |
Creates a 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 timeZoneNew
with the value of
the TZ
environment variable (including the possibility of Nothing
).
You should release the return value by calling timeZoneUnref
when you are done with it.
Since: 2.26
newOffset
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> m TimeZone | Returns: a timezone at the given offset from UTC |
Creates a TimeZone
corresponding to the given constant offset from UTC,
in seconds.
This is equivalent to calling timeZoneNew
with a string in the form
[+|-]hh[:mm[:ss]]
.
Since: 2.58
newUtc
:: (HasCallStack, MonadIO m) | |
=> m TimeZone | Returns: the universal timezone |
Creates a TimeZone
corresponding to UTC.
This is equivalent to calling timeZoneNew
with a value like
"Z", "UTC", "+00", etc.
You should release the return value by calling timeZoneUnref
when you are done with it.
Since: 2.26
ref
:: (HasCallStack, MonadIO m) | |
=> TimeZone |
|
-> m TimeZone | Returns: a new reference to |
Increases the reference count on tz
.
Since: 2.26
unref
:: (HasCallStack, MonadIO m) | |
=> TimeZone |
|
-> m () |
Decreases the reference count on tz
.
Since: 2.26