tz 0.0.0.8 → 0.0.0.9
raw patch · 3 files changed
+27/−17 lines, 3 filesdep ~criteriondep ~time
Dependency ranges changed: criterion, time
Files
- Data/Time/Zones/Read.hs +18/−7
- tests/testTZ.hs +1/−2
- tz.cabal +8/−8
Data/Time/Zones/Read.hs view
@@ -21,6 +21,7 @@ ) where import Control.Applicative+import Control.Exception (assert) import Control.Monad import Data.Binary import Data.Binary.Get@@ -144,13 +145,23 @@ let isDst (_,x,_) = x gmtOff (x,_,_) = x isDstName (_,d,ni) = (d, abbrForInd ni abbrs)- lInfos = VU.toList infos- first = head $ filter (not . isDst) lInfos ++ lInfos- vtrans = VU.cons minBound transitions- eInfos = VU.cons first $ VU.map (infos VU.!) indices- vdiffs = VU.map gmtOff eInfos- vinfos = VB.map isDstName $ unstream $ stream eInfos- return $ TZ vtrans vdiffs vinfos+ vInfos = VU.map (infos VU.!) indices+ -- Older tz databases didn't have an explicit first transition,+ -- but since 2014c they do. (In 2014c it's minBound and in+ -- later versions it's the large negative constant below.)+ (eTransitions, eInfos) = case () of+ _ | hasInitTrans -> assert infosHeadIsDst (transitions', vInfos)+ _ -> (VU.cons minBound transitions, VU.cons first vInfos)+ where+ hasInitTrans = not (VU.null transitions)+ && VU.head transitions <= -0x800000000000000+ transitions' = transitions VU.// [(0, minBound)]+ infosHeadIsDst = not $ isDst $ VU.head infos+ lInfos = VU.toList infos+ first = head $ filter (not . isDst) lInfos ++ lInfos+ diffs = VU.map gmtOff eInfos+ tzInfos = VB.map isDstName $ unstream $ stream eInfos+ return $ TZ eTransitions diffs tzInfos abbrForInd :: Int -> BS.ByteString -> String abbrForInd i = BS.unpack . BS.takeWhile (/= '\0') . BS.drop i
tests/testTZ.hs view
@@ -127,8 +127,7 @@ case_DB_utc_is_utc = do tz <- loadTZFromDB "UTC"- V.forM_ (_tzDiffs tz) (@?= 0)- V.forM_ (_tzInfos tz) (@?= (False, "UTC"))+ tz @?= utcTZ mkLocal y m d hh mm ss = LocalTime (fromGregorian y m d) (TimeOfDay hh mm ss)
tz.cabal view
@@ -1,5 +1,5 @@ Name: tz-Version: 0.0.0.8+Version: 0.0.0.9 License: Apache-2.0 License-File: LICENSE Author: Mihaly Barasz, Gergely Risko@@ -53,7 +53,7 @@ bytestring >= 0.9 && < 0.11, containers >= 0.5 && < 0.6, deepseq >= 1.1 && < 2,- time >= 1.2 && < 1.5,+ time >= 1.2 && < 1.6, tzdata >= 0.1 && < 0.2, vector >= 0.9 && < 0.11 if flag(template-haskell)@@ -81,7 +81,7 @@ 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.5,+ time >= 1.2 && < 1.6, unix >= 2.6 && < 3, vector >= 0.9 && < 0.11 @@ -126,8 +126,8 @@ tz, base >= 4 && < 5, bindings-posix >= 1.2 && < 2,- criterion >= 0.8 && < 0.9,- time >= 1.2 && < 1.5,+ criterion >= 0.8 && < 1.1,+ time >= 1.2 && < 1.6, timezone-olson, timezone-series, unix >= 2.6 && < 3@@ -142,7 +142,7 @@ tz, base >= 4 && < 5, bindings-posix >= 1.2 && < 2,- criterion >= 0.8 && < 0.9,+ criterion >= 0.8 && < 1.1, unix >= 2.6 && < 3 Benchmark bench_greg@@ -154,7 +154,7 @@ Build-Depends: tz, base >= 4 && < 5,- criterion >= 0.8 && < 0.9,+ criterion >= 0.8 && < 1.1, lens, thyme, time@@ -168,5 +168,5 @@ Build-Depends: tz, base >= 4 && < 5,- criterion >= 0.8 && < 0.9,+ criterion >= 0.8 && < 1.1, time