zoneinfo-0.3: ZoneInfo library.

Data.Time.ZoneInfo

Description

Provides access to the Olson zone-info database, using an adapted version of the Olson zone-info library.

Synopsis

Documentation

type Olson = ForeignPtr COlsonSource

type ZoneInfo = (Olson, Ptr CZoneInfo)Source

A ZoneInfo object's lifetime is bound to its Olson parent. The pair includes the Olson parent to ensure that it is not garbage collected while the ZoneInfo object is still in use.

newOlson :: Maybe String -> IO OlsonSource

Create a new Olson context object. A path to the zone-info database may be specified. Otherwise, the TZDIR environment variable, or a reasonable default, will be used. An IOError will be thrown on failure.

getZoneInfo :: Olson -> String -> IO ZoneInfoSource

Obtain a ZoneInfo object based on the specified Olson identifier or time-zone. If the zone-info database cannot be found, or the time-zone not recognised, then an IOError will be thrown. Calls to this function must be serialised across multiple threads.

utcZoneInfo :: Olson -> ZoneInfoSource

ZoneInfo for the UTC time-zone.

getZoneName :: ZoneInfo -> Bool -> IO StringSource

Returns the zone-name for either the standard or daylight saving zone, depending on the isdst argument.

getZoneMinutes :: ZoneInfo -> Bool -> IO IntSource

Returns the UTC offset for either the standard or daylight saving zone, depending on the isdst argument.

localToPOSIXZoned :: ZoneInfo -> LocalTime -> IO (POSIXTime, ZonedTime)Source

Convert LocalTime to a daylight saving adjusted pair.

localToUTCZoned :: ZoneInfo -> LocalTime -> IO (UTCTime, ZonedTime)Source

Convert LocalTime to a daylight saving adjusted pair.

convertTimeZone :: ZoneInfo -> LocalTime -> ZoneInfo -> IO ZonedTimeSource

Convert the LocalTime argument from the source to destination TimeZone.