@@ -1,9 +1,8 @@
1{-# OPTIONS_HADDOCK hide #-}
1{-# OPTIONS_HADDOCK hide #-}
3-----------------------------------------------------------------------------
2-----------------------------------------------------------------------------
5-- Module : Data.Time.LocalTime.TimeZone.Olson.Types
4-- Module : Data.Time.LocalTime.TimeZone.Olson.Types
6−-- Copyright : Yitzchak Gale 2018
5+-- Copyright : Yitzchak Gale 2010
8-- Maintainer : Yitzchak Gale <gale@sefer.org>
7-- Maintainer : Yitzchak Gale <gale@sefer.org>
9-- Portability : portable
8-- Portability : portable
@@ -15,7 +14,7 @@
16-- Both Version 1 and Version 2 timezone data can be represented.
15-- Both Version 1 and Version 2 timezone data can be represented.
18−{- Copyright (c) 2018 Yitzchak Gale. All rights reserved.
17+{- Copyright (c) 2010 Yitzchak Gale. All rights reserved.
19For licensing information, see the BSD3-style license in the file
18For licensing information, see the BSD3-style license in the file
20LICENSE that was originally distributed by the author together with
19LICENSE that was originally distributed by the author together with
21this file. -}
20this file. -}
@@ -37,33 +36,22 @@ module Data.Time.LocalTime.TimeZone.Olson.Types
40−#if MIN_VERSION_base(4,11,0)
41−import Data.Semigroup (Semigroup(..))
43import Data.Monoid (Monoid(..))
39import Data.Monoid (Monoid(..))
44import Control.Monad (mplus)
40import Control.Monad (mplus)
46-- | @OlsonData@ represents a full set of timezone data for a location.
42-- | @OlsonData@ represents a full set of timezone data for a location.
48−-- @OlsonData@ can represent timezone data from files in Version 1, 2,
44+-- @OlsonData@ can represent timezone data from files in Version 1 format
49−-- or 3 format.
45+-- or Version 2 format. Version 1 format files can only contain timestamp
46+-- values that can be represented in less than 32 bits, and cannot contain
51−-- Version 1 format files can only contain timestamp values that can
52−-- be represented in less than 32 bits, and cannot contain a POSIX TZ
55−-- In a Version 2 format file, the timezone data is split into two
49+-- In a Version 2 format file, the timezone data is split into two parts.
56−-- parts. The first part contains timezone data for which all
50+-- The first part contains timezone data for which all timestamp values
57−-- timestamp values can be represented in less than 32 bits, and the
51+-- can be represented in less than 32 bits, and the second part contains
58−-- second part contains timezone data for which 32 bits or more are
52+-- timezone data for which 32 bits or more are required to represent
59−-- required to represent timestamp values. The POSIX TZ string, if
53+-- timestamp values. The POSIX TZ string, if present, can only be rendered
60−-- present, can only be rendered in a Version 2 file, and appears
61−-- after both parts of the timezone data.
54+-- in a Version 2 file, and appears after both parts of the timezone data.
63−-- Version 3 format files relax certain syntax requirements for the
64−-- POSIX TZ string. Since we represent the POSIX TZ string as an
65−-- unparsed 'String', Version 3 is identical to Version 2 for our
67data OlsonData =
55data OlsonData =
68 OlsonData {
56 OlsonData {
69 olsonTransitions :: [Transition],
57 olsonTransitions :: [Transition],
@@ -75,17 +63,6 @@ data OlsonData =
76 deriving (Eq, Show)
64 deriving (Eq, Show)
78−#if MIN_VERSION_base(4,11,0)
79−instance Semigroup OlsonData where
80− OlsonData a b c d <> OlsonData a' b' c' d' =
81− OlsonData (a ++ map (shiftBy $ length b) a')
82− (b ++ b') (c ++ c') (d `mplus` d')
84− shiftBy n trans = trans {transIndex = n + transIndex trans}
86−instance Monoid OlsonData where
87− mempty = OlsonData [] [] [] Nothing
89instance Monoid OlsonData where
66instance Monoid OlsonData where
90 mempty = OlsonData [] [] [] Nothing
67 mempty = OlsonData [] [] [] Nothing
91 mappend (OlsonData a b c d ) (OlsonData a' b' c' d') =
68 mappend (OlsonData a b c d ) (OlsonData a' b' c' d') =
@@ -93,7 +70,6 @@ instance Monoid OlsonData where
93 (b ++ b') (c ++ c') (d `mplus` d')
70 (b ++ b') (c ++ c') (d `mplus` d')
95 shiftBy n trans = trans {transIndex = n + transIndex trans}
72 shiftBy n trans = trans {transIndex = n + transIndex trans}
98-- | A @Transition@ represents a moment when the clocks change in a
74-- | A @Transition@ represents a moment when the clocks change in a
99-- timezone. It consists of a Unix timestamp value that indicates the
75-- timezone. It consists of a Unix timestamp value that indicates the