tz 0.1.0.1 → 0.1.1.0
raw patch · 5 files changed
+53/−35 lines, 5 filesdep +data-defaultdep ~binarydep ~timePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: data-default
Dependency ranges changed: binary, time
API changes (from Hackage documentation)
- Data.Time.Zones.All: America__Cayman :: TZLabel
- Data.Time.Zones.All: America__Santa_Isabel :: TZLabel
+ Data.Time.Zones: instance Control.DeepSeq.NFData Data.Time.Zones.FromLocal
+ Data.Time.Zones: instance Control.DeepSeq.NFData Data.Time.Zones.LocalToUTCResult
+ Data.Time.Zones: instance Data.Data.Data Data.Time.Zones.FromLocal
+ Data.Time.Zones: instance Data.Data.Data Data.Time.Zones.LocalToUTCResult
+ Data.Time.Zones: instance GHC.Classes.Eq Data.Time.Zones.FromLocal
+ Data.Time.Zones: instance GHC.Read.Read Data.Time.Zones.FromLocal
+ Data.Time.Zones: instance GHC.Read.Read Data.Time.Zones.LocalToUTCResult
+ Data.Time.Zones.All: America__Fort_Nelson :: TZLabel
+ Data.Time.Zones.All: Asia__Barnaul :: TZLabel
+ Data.Time.Zones.All: Asia__Tomsk :: TZLabel
+ Data.Time.Zones.All: Europe__Astrakhan :: TZLabel
+ Data.Time.Zones.All: Europe__Kirov :: TZLabel
+ Data.Time.Zones.All: Europe__Ulyanovsk :: TZLabel
+ Data.Time.Zones.Types: instance Data.Data.Data Data.Time.Zones.Types.TZ
+ Data.Time.Zones.Types: instance Data.Default.Class.Default Data.Time.Zones.Types.TZ
+ Data.Time.Zones.Types: instance GHC.Read.Read Data.Time.Zones.Types.TZ
+ Data.Time.Zones.Types: utcTZ :: TZ
Files
- Data/Time/Zones.hs +18/−13
- Data/Time/Zones/Read.hs +4/−1
- Data/Time/Zones/Types.hs +16/−4
- stack.yaml +2/−5
- tz.cabal +13/−12
Data/Time/Zones.hs view
@@ -7,10 +7,11 @@ -} {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE DeriveDataTypeable #-} module Data.Time.Zones ( TZ,- utcTZ,+ Data.Time.Zones.Types.utcTZ, -- * Universal -> Local direction diffForPOSIX, timeZoneForPOSIX,@@ -32,14 +33,16 @@ diffForAbbr, ) where -import Data.Bits (shiftR)-import Data.Int (Int64)-import Data.Time+import Control.DeepSeq+import Data.Bits (shiftR)+import Data.Data+import Data.Int (Int64)+import Data.Time+import Data.Time.Zones.Internal+import Data.Time.Zones.Read+import Data.Time.Zones.Types import qualified Data.Vector as VB import qualified Data.Vector.Unboxed as VU-import Data.Time.Zones.Types-import Data.Time.Zones.Read-import Data.Time.Zones.Internal -- | Returns the time difference (in seconds) for TZ at the given -- POSIX time.@@ -77,10 +80,6 @@ (ut, ps) = utcTimeToInt64Pair utcT ut' = ut + fromIntegral (diffForPOSIX tz ut) --- | The `TZ` definition for UTC.-utcTZ :: TZ-utcTZ = TZ (VU.singleton minBound) (VU.singleton 0) (VB.singleton (False, "UTC"))- -- | Returns the largest index `i` such that `v ! i <= t`. -- -- Assumes that `v` is sorted, has at least one element and `v ! 0 <= t`.@@ -134,8 +133,11 @@ | FLDouble { _flIx :: {-# UNPACK #-} !Int , _flRes1 :: {-# UNPACK #-} !Int64 , _flRes2 :: {-# UNPACK #-} !Int64 }- deriving (Show)+ deriving (Eq, Show, Read, Typeable, Data) +instance NFData FromLocal where+ rnf !_ = ()+ -- We make the following two assumptions here: -- -- 1. No diff in any time zone is ever bigger than 24 hours.@@ -193,7 +195,10 @@ , _ltuSecond :: UTCTime , _ltuFirstZone :: TimeZone , _ltuSecondZone :: TimeZone- } deriving (Eq, Show)+ } deriving (Eq, Show, Read, Typeable, Data)++instance NFData LocalToUTCResult where+ rnf !_ = () -- TODO(klao): better name localTimeToUTCFull :: TZ -> LocalTime -> LocalToUTCResult
Data/Time/Zones/Read.hs view
@@ -24,7 +24,7 @@ import Control.Exception (assert) import Control.Monad import Data.Binary-import Data.Binary.Get+import Data.Binary.Get (getByteString, getWord32be, getWord64be, runGet, skip) import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Lazy.Char8 as BL import Data.Maybe@@ -35,6 +35,9 @@ import Data.Time.Zones.Types import System.Environment import System.IO.Error++-- Suppress 'redundant imports' warning+import Prelude -- | Reads and parses a time zone information file (in @tzfile(5)@ -- aka. Olson file format) and returns the corresponding TZ data
Data/Time/Zones/Types.hs view
@@ -6,14 +6,19 @@ Stability : experimental -} +{-# LANGUAGE DeriveDataTypeable #-}+ module Data.Time.Zones.Types ( TZ(..),+ utcTZ, ) where -import Control.DeepSeq-import Data.Int-import qualified Data.Vector.Unboxed as VU+import Control.DeepSeq+import Data.Data+import Data.Default+import Data.Int import qualified Data.Vector as VB+import qualified Data.Vector.Unboxed as VU data TZ = TZ { _tzTrans :: !(VU.Vector Int64),@@ -22,7 +27,14 @@ -- (short) vector of expanded 'TimeZone's, similarly to how it's -- stored? _tzInfos :: !(VB.Vector (Bool, String)) -- (summer, name)- } deriving (Eq,Show)+ } deriving (Eq, Show, Typeable, Data, Read) instance NFData TZ where rnf (TZ { _tzInfos = infos }) = rnf infos++-- | The `TZ` definition for UTC.+utcTZ :: TZ+utcTZ = TZ (VU.singleton minBound) (VU.singleton 0) (VB.singleton (False, "UTC"))++instance Default TZ where+ def = utcTZ
stack.yaml view
@@ -1,17 +1,14 @@ # For more information, see: https://github.com/commercialhaskell/stack/blob/release/doc/yaml_configuration.md # Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)-resolver: lts-3.17+resolver: lts-5.15 # Local packages, usually specified by relative directory name packages: - '.' # Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)-extra-deps:-- bindings-posix-1.2.6-- criterion-1.1.0.0-- tzdata-0.1.20150810.0+extra-deps: [] # Override default flag values for local packages and extra-deps flags: {}
tz.cabal view
@@ -1,5 +1,5 @@ Name: tz-Version: 0.1.0.1+Version: 0.1.1.0 License: Apache-2.0 License-File: LICENSE Author: Mihaly Barasz, Gergely Risko@@ -50,11 +50,12 @@ GHC-Options: -Wall Build-Depends: base >= 4 && < 5,- binary >= 0.5 && < 0.8,+ binary >= 0.5 && < 0.9, bytestring >= 0.9 && < 0.11, containers >= 0.5 && < 0.6,+ data-default >= 0.5 && < 0.7, deepseq >= 1.1 && < 2,- time >= 1.2 && < 1.6,+ time >= 1.2 && < 1.7, tzdata >= 0.1 && < 0.2, vector >= 0.9 && < 0.12 if flag(template-haskell)@@ -76,13 +77,13 @@ tz, base >= 4 && < 5, bindings-posix >= 1.2 && < 2,- HUnit >= 1.2 && < 1.3,+ HUnit >= 1.2 && < 1.4, QuickCheck >= 2.4 && < 3, test-framework >= 0.4 && < 1, test-framework-hunit >= 0.2 && < 0.4, test-framework-quickcheck2 >= 0.2 && < 0.4, test-framework-th >= 0.2 && < 0.4,- time >= 1.2 && < 1.6,+ time >= 1.2 && < 1.7, unix >= 2.6 && < 3, vector >= 0.9 && < 0.12 @@ -97,7 +98,7 @@ Build-Depends: tz, base >= 4 && < 5,- HUnit >= 1.2 && < 1.3,+ HUnit >= 1.2 && < 1.4, test-framework >= 0.4 && < 1, test-framework-hunit >= 0.2 && < 0.4, test-framework-th >= 0.2 && < 0.4@@ -112,7 +113,7 @@ tz, tzdata, base >= 4 && < 5,- HUnit >= 1.2 && < 1.3,+ HUnit >= 1.2 && < 1.4, test-framework >= 0.4 && < 1, test-framework-hunit >= 0.2 && < 0.4, test-framework-th >= 0.2 && < 0.4@@ -127,8 +128,8 @@ tz, base >= 4 && < 5, bindings-posix >= 1.2 && < 2,- criterion >= 0.8 && < 1.1,- time >= 1.2 && < 1.6,+ criterion >= 0.8 && < 1.2,+ time >= 1.2 && < 1.7, timezone-olson, timezone-series, unix >= 2.6 && < 3@@ -143,7 +144,7 @@ tz, base >= 4 && < 5, bindings-posix >= 1.2 && < 2,- criterion >= 0.8 && < 1.1,+ criterion >= 0.8 && < 1.2, unix >= 2.6 && < 3 Benchmark bench_greg@@ -155,7 +156,7 @@ Build-Depends: tz, base >= 4 && < 5,- criterion >= 0.8 && < 1.1,+ criterion >= 0.8 && < 1.2, lens, thyme, time@@ -169,5 +170,5 @@ Build-Depends: tz, base >= 4 && < 5,- criterion >= 0.8 && < 1.1,+ criterion >= 0.8 && < 1.2, time