Timex.Timezone.Local

This module is responsible for determining the timezone configuration of the local machine. It determines this from a number of sources, depending on platform, but the order of precedence is as follows:

ALL: - TZ environment variable. Ignored if nil/empty

OSX: - /etc/localtime - systemsetup -gettimezone (if admin rights are present)

UNIX: - /etc/timezone - /etc/sysconfig/clock - /etc/conf.d/clock - /etc/localtime - /usr/local/etc/localtime

Windows: - SYSTEM registry for the currently configured TimeZoneInformation

Each location is tried, and if an error is encountered, the next is attempted, until either a successful lookup is performed, or we run out of locations to check.

Summary

lookup()

Looks up the local timezone configuration. Returns the name of a timezone in the Olson database

lookup(date)
parse_tzfile(tzdata)

Given a binary representing the data from a tzfile (not the source version), parses out the timezone for the provided reference date

parse_tzfile(tzdata, reference_date)

Given a binary representing the data from a tzfile (not the source version), parses out the timezone for the current UTC date/time

Functions

lookup()

Looks up the local timezone configuration. Returns the name of a timezone in the Olson database.

lookup(date)

Specs:

parse_tzfile(tzdata)

Specs:

  • parse_tzfile(binary) :: {:ok, String.t} | {:error, term}

Given a binary representing the data from a tzfile (not the source version), parses out the timezone for the provided reference date

parse_tzfile(tzdata, reference_date)

Specs:

Given a binary representing the data from a tzfile (not the source version), parses out the timezone for the current UTC date/time.