timezone-series-0.1.13: Enhanced timezone handling for Data.Time
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Time.LocalTime.TimeZone.Series

Description

A TimeZoneSeries describes a timezone by specifying the various clock settings that occurred in the past and are scheduled to occur in the future for the timezone.

Synopsis

Representing a timezone

A TimeZoneSeries describes a timezone with a set of TimeZone objects. Each TimeZone object describes the clock setting in the timezone for a specific period of history during which the clocks do not change.

Most operating systems provide information about timezone series for the local timezone and for many other timezones of the world. On MS Windows systems, this information can be read from the registry. On other systems, this information is typically provided in the form of Olson timezone files: /etc/localtime (or some other file) for the local timezone, and files located in /usr/share/zoneinfo/ or /etc/zoneinfo/ (or some other directory) for other timezones.

data TimeZoneSeries #

A TimeZoneSeries consists of a default TimeZone object and a sequence of pairs of a UTCTime and a TimeZone object. Each UTCTime indicates a moment at which the clocks changed, and the corresponding TimeZone object describes the new state of the clocks after the change. The default TimeZone object is used for times preceding the earliest UTCTime, or if the sequence of pairs is empty. The times in the sequence are in order from latest to earlist (note that this is the opposite of the way that they are stored in an Olson timezone file).

Constructors

TimeZoneSeries 

Fields

Instances

Instances details
Read TimeZoneSeries # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

Show TimeZoneSeries # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

NFData TimeZoneSeries # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

Methods

rnf :: TimeZoneSeries -> () #

Eq TimeZoneSeries # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

Ord TimeZoneSeries # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

FormatTime TimeZoneSeries # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

ParseTime TimeZoneSeries # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

timeZoneFromSeries :: TimeZoneSeries -> UTCTime -> TimeZone #

Given a timezone represented by a TimeZoneSeries, and a UTCTime, provide the state of the timezone's clocks at that time.

isValidLocalTime :: TimeZoneSeries -> LocalTime -> Bool #

When a clock change moves the clock forward, local times that are between the wall clock time before the change and the wall clock time after the change cannot occur.

isRedundantLocalTime :: TimeZoneSeries -> LocalTime -> Bool #

When a clock change moves the clock backward, local times that are between the wall clock time before the change and the wall clock time after the change occur twice.

latestNonSummer :: TimeZoneSeries -> TimeZone #

The latest non-summer TimeZone in a TimeZoneSeries is in some sense representative of the timezone.

Converting between UTC and local time

The following functions are variants on functions in Data.Time.LocalTime that convert between UTC and local time. The originals can give a wrong result if the TimeZone used for the conversion is not actually in effect at the specified time. These variants use a TimeZoneSeries instead of a TimeZone.

When converting from an invalid local time, the local time is interpreted as if the time change that made it invalid never happened. When converting from a redundant local time, the latest possible interpretation is used. Use the functions isValidLocalTime and isRedundantLocalTime to detect these conditions.

utcToLocalTime' :: TimeZoneSeries -> UTCTime -> LocalTime #

Convert a UTC time to local time using the TimeZone that is in effect at that time in the timezone represented by TimeZoneSeries.

localTimeToUTC' :: TimeZoneSeries -> LocalTime -> UTCTime #

Convert a local time to UTC using the TimeZone that is in effect at that time in the timezone represented by TimeZoneSeries. Local times that are invalid or redundant are treated as described above.

Representing a moment in a timezone

data ZoneSeriesTime #

A ZoneSeriesTime represents a moment of time in the context of a particular timezone.

Instances

Instances details
Read ZoneSeriesTime # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

Show ZoneSeriesTime # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

Eq ZoneSeriesTime # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

Ord ZoneSeriesTime # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

FormatTime ZoneSeriesTime # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

ParseTime ZoneSeriesTime # 
Instance details

Defined in Data.Time.LocalTime.TimeZone.Series

zonedTimeToZoneSeriesTime :: ZonedTime -> ZoneSeriesTime #

Use a trivial TimeZoneSeries containing only the TimeZone of the ZonedTime, and use it to define a ZoneSeriesTime.

zoneSeriesTimeToLocalTime :: ZoneSeriesTime -> LocalTime #

The local time represented by a ZoneSeriesTime

zoneSeriesTimeZone :: ZoneSeriesTime -> TimeZone #

The TimeZone that is in effect at the moment represented by a ZoneSeriesTime.

localTimeToZoneSeriesTime :: TimeZoneSeries -> LocalTime -> ZoneSeriesTime #

The ZoneSeriesTime that represents the given local time in the given timezone. Local times that are invalid or redundant are treated as described below.