tz-0.0.0.4: Time zones database and library

Stabilityexperimental
MaintainerMihaly Barasz <klao@nilcons.com>
Safe HaskellNone

Data.Time.Zones.Read

Contents

Description

 

Synopsis

Various ways of loading TZ

loadTZFromFile :: FilePath -> IO TZSource

Reads and parses a time zone information file (in tzfile(5) aka. Olson file format) and returns the corresponding TZ data structure.

loadSystemTZ :: String -> IO TZSource

Looks for the time zone file in the system timezone directory, which is /usr/share/zoneinfo, or if the TZDIR environment variable is set, then there.

loadLocalTZ :: IO TZSource

Returns the local TZ based on the TZ and TZDIR environment variables.

See tzset(3) for details, but basically:

  • If TZ environment variable is unset, we loadTZFromFile "/etc/localtime".
  • If TZ is set, but empty, we loadSystemTZ "UTC".
  • Otherwise, we just loadSystemTZ it.

Note, this means we don't support POSIX-style TZ variables (like "EST5EDT"), only those that are explicitly present in the time zone database.

loadTZFromDB :: String -> IO TZSource

Reads the corresponding file from the time zone database shipped with this package.

Reading only the description, no parsing

Parsing Olson data