git.iko.soy/typeable/timezone-olson
on master help sign in
9 files changed+187−85
since splitsnapshots
unifiedsplit
.gitignore+16 .travis.yml+107 Data/Time/LocalTime/TimeZone/Olson.hs+2−2 Data/Time/LocalTime/TimeZone/Olson/Parse.hs+2−2 Data/Time/LocalTime/TimeZone/Olson/Render.hs+2−2 Data/Time/LocalTime/TimeZone/Olson/Types.hs+18−2 LICENSE+1−1 README → README.md+18−24 timezone-olson.cabal+21−52
.gitignorenew file+16
@@ -0,0 +1,16 @@
1+dist
2+cabal-dev
3+*.o
4+*.hi
5+*.chi
6+*.chs.h
7+*.dyn_o
8+*.dyn_hi
9+.virtualenv
10+.hpc
11+.hsenv
12+.cabal-sandbox/
13+cabal.sandbox.config
14+*.prof
15+*.aux
16+*.hp
.travis.ymlnew file+107
@@ -0,0 +1,107 @@
1+# This Travis job script has been generated by a script via
2+#
3+# runghc make_travis_yml_2.hs 'timezone-olson.cabal'
4+#
5+# For more information, see https://github.com/hvr/multi-ghc-travis
6+#
7+language: c
8+sudo: false
9+
10+git:
11+ submodules: false # whether to recursively clone submodules
12+
13+cache:
14+ directories:
15+ - $HOME/.cabal/packages
16+ - $HOME/.cabal/store
17+
18+before_cache:
19+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log
20+ # remove files that are regenerated by 'cabal update'
21+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*
22+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json
23+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache
24+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar
25+ - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx
26+
27+ - rm -rfv $HOME/.cabal/packages/head.hackage
28+
29+matrix:
30+ include:
31+ - compiler: "ghc-8.0.1"
32+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
33+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.1], sources: [hvr-ghc]}}
34+ - compiler: "ghc-8.0.2"
35+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
36+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.0.2], sources: [hvr-ghc]}}
37+ - compiler: "ghc-8.2.1"
38+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
39+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.1], sources: [hvr-ghc]}}
40+ - compiler: "ghc-8.2.2"
41+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
42+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.2.2], sources: [hvr-ghc]}}
43+ - compiler: "ghc-8.4.1"
44+ # env: TEST=--disable-tests BENCH=--disable-benchmarks
45+ addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}
46+
47+before_install:
48+ - HC=${CC}
49+ - HCPKG=${HC/ghc/ghc-pkg}
50+ - unset CC
51+ - ROOTDIR=$(pwd)
52+ - mkdir -p $HOME/.local/bin
53+ - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"
54+ - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
55+ - echo $HCNUMVER
56+
57+install:
58+ - cabal --version
59+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
60+ - BENCH=${BENCH---enable-benchmarks}
61+ - TEST=${TEST---enable-tests}
62+ - HADDOCK=${HADDOCK-true}
63+ - INSTALLED=${INSTALLED-true}
64+ - GHCHEAD=${GHCHEAD-false}
65+ - travis_retry cabal update -v
66+ - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"
67+ - rm -fv cabal.project cabal.project.local
68+ - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'
69+ - "printf 'packages: \".\"\\n' > cabal.project"
70+ - cat cabal.project
71+ - if [ -f "./configure.ac" ]; then
72+ (cd "." && autoreconf -i);
73+ fi
74+ - rm -f cabal.project.freeze
75+ - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
76+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
77+ - rm -rf .ghc.environment.* "."/dist
78+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
79+
80+# Here starts the actual work to be performed for the package under test;
81+# any command which exits with a non-zero exit code causes the build to fail.
82+script:
83+ # test that source-distributions can be generated
84+ - (cd "." && cabal sdist)
85+ - mv "."/dist/timezone-olson-*.tar.gz ${DISTDIR}/
86+ - cd ${DISTDIR} || false
87+ - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
88+ - "printf 'packages: timezone-olson-*/*.cabal\\n' > cabal.project"
89+ - cat cabal.project
90+ # this builds all libraries and executables (without tests/benchmarks)
91+ - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all
92+
93+ # Build with installed constraints for packages in global-db
94+ - if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi
95+
96+ # build & run tests, build benchmarks
97+ - cabal new-build -w ${HC} ${TEST} ${BENCH} all
98+
99+ # cabal check
100+ - (cd timezone-olson-* && cabal check)
101+
102+ # haddock
103+ - rm -rf ./dist-newstyle
104+ - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi
105+
106+# REGENDATA ["timezone-olson.cabal"]
107+# EOF
Data/Time/LocalTime/TimeZone/Olson.hs+2−2
@@ -1,7 +1,7 @@
11-----------------------------------------------------------------------------
22-- |
33-- Module : Data.Time.LocalTime.TimeZone.Olson
4−-- Copyright : Yitzchak Gale 2010
4+-- Copyright : Yitzchak Gale 2018
55--
66-- Maintainer : Yitzchak Gale <gale@sefer.org>
77-- Portability : portable
@@ -13,7 +13,7 @@
1313-- converting the parsed data into @TimeZoneSeries@ and @TimeZone@
1414-- objects.
1515
16−{- Copyright (c) 2010 Yitzchak Gale. All rights reserved.
16+{- Copyright (c) 2018 Yitzchak Gale. All rights reserved.
1717For licensing information, see the BSD3-style license in the file
1818LICENSE that was originally distributed by the author together with
1919this file. -}
Data/Time/LocalTime/TimeZone/Olson/Parse.hs+2−2
@@ -3,7 +3,7 @@
33-----------------------------------------------------------------------------
44-- |
55-- Module : Data.Time.LocalTime.TimeZone.Olson.Parse
6−-- Copyright : Yitzchak Gale 2010
6+-- Copyright : Yitzchak Gale 2018
77--
88-- Maintainer : Yitzchak Gale <gale@sefer.org>
99-- Portability : portable
@@ -14,7 +14,7 @@
1414-- <http://www.twinsun.com/tz/tz-link.htm>. Functions are provided for
1515-- converting the parsed data into 'TimeZoneSeries' objects.
1616
17−{- Copyright (c) 2010 Yitzchak Gale. All rights reserved.
17+{- Copyright (c) 2018 Yitzchak Gale. All rights reserved.
1818For licensing information, see the BSD3-style license in the file
1919LICENSE that was originally distributed by the author together with
2020this file. -}
Data/Time/LocalTime/TimeZone/Olson/Render.hs+2−2
@@ -2,7 +2,7 @@
22-----------------------------------------------------------------------------
33-- |
44-- Module : Data.Time.LocalTime.TimeZone.Olson.Render
5−-- Copyright : Yitzchak Gale 2010
5+-- Copyright : Yitzchak Gale 2018
66--
77-- Maintainer : Yitzchak Gale <gale@sefer.org>
88-- Portability : portable
@@ -12,7 +12,7 @@
1212-- Unix-like systems. For more information about this format, see
1313-- <http://www.twinsun.com/tz/tz-link.htm>.
1414
15−{- Copyright (c) 2010 Yitzchak Gale. All rights reserved.
15+{- Copyright (c) 2018ZZ Yitzchak Gale. All rights reserved.
1616For licensing information, see the BSD3-style license in the file
1717LICENSE that was originally distributed by the author together with
1818this file. -}
Data/Time/LocalTime/TimeZone/Olson/Types.hs+18−2
@@ -1,8 +1,9 @@
11{-# OPTIONS_HADDOCK hide #-}
2+{-# LANGUAGE CPP #-}
23-----------------------------------------------------------------------------
34-- |
45-- Module : Data.Time.LocalTime.TimeZone.Olson.Types
5−-- Copyright : Yitzchak Gale 2010
6+-- Copyright : Yitzchak Gale 2018
67--
78-- Maintainer : Yitzchak Gale <gale@sefer.org>
89-- Portability : portable
@@ -14,7 +15,7 @@
1415--
1516-- Both Version 1 and Version 2 timezone data can be represented.
1617
17−{- Copyright (c) 2010 Yitzchak Gale. All rights reserved.
18+{- Copyright (c) 2018 Yitzchak Gale. All rights reserved.
1819For licensing information, see the BSD3-style license in the file
1920LICENSE that was originally distributed by the author together with
2021this file. -}
@@ -36,6 +37,9 @@ module Data.Time.LocalTime.TimeZone.Olson.Types
3637)
3738where
3839
40+#if MIN_VERSION_base(4,11,0)
41+import Data.Semigroup (Semigroup(..))
42+#endif
3943import Data.Monoid (Monoid(..))
4044import Control.Monad (mplus)
4145
@@ -71,6 +75,17 @@ data OlsonData =
7175 }
7276 deriving (Eq, Show)
7377
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')
83+ where
84+ shiftBy n trans = trans {transIndex = n + transIndex trans}
85+
86+instance Monoid OlsonData where
87+ mempty = OlsonData [] [] [] Nothing
88+#else
7489instance Monoid OlsonData where
7590 mempty = OlsonData [] [] [] Nothing
7691 mappend (OlsonData a b c d ) (OlsonData a' b' c' d') =
@@ -78,6 +93,7 @@ instance Monoid OlsonData where
7893 (b ++ b') (c ++ c') (d `mplus` d')
7994 where
8095 shiftBy n trans = trans {transIndex = n + transIndex trans}
96+#endif
8197
8298-- | A @Transition@ represents a moment when the clocks change in a
8399-- timezone. It consists of a Unix timestamp value that indicates the
LICENSE+1−1
@@ -1,4 +1,4 @@
1−Copyright (c) 2010 Yitzchak Gale. All rights reserved.
1+Copyright (c) 2010-2018 Yitzchak Gale. All rights reserved.
22
33Redistribution and use in source and binary forms, with or without
44modification, are permitted provided that the following conditions are
README → README.mdrenamed+18−24
@@ -1,39 +1,33 @@
1−timezone-olson version 0.1.0
1+# timezone-olson
2+
3+On Hackage: [timezone-olson](http://hackage.haskell.org/package/timezone-olson)
24
35This package provides a parser and renderer for binary Olson timezone
46files whose format is specified by the tzfile(5) man page on Unix-like
57systems. For more information about this format, see
6−<http://www.twinsun.com/tz/tz-link.htm>. Functions are provided for
7−converting the parsed data into 'TimeZoneSeries' objects from the
8−timezone-series package. On many platforms, binary Olson timezone
8+[the IANA timezone database site](https://www.iana.org/time-zones).
9+
10+Functions are provided for
11+converting the parsed data into `TimeZoneSeries` objects from the
12+[timezone-series](http://hackage.haskell.org/package/timezone-series)
13+package. On many platforms, binary Olson timezone
914files suitable for use with this package are available in the
10−directory /usr/share/zoneinfo and its subdirectories on your computer.
15+directory `/usr/share/zoneinfo` and its subdirectories on your computer.
1116
12−This version of timezone-olson is highly experimental. Expect there
13−to be bugs, and do not rely on any stability of the exposed
14−interfaces.
17+See also the
18+[timezone-olson-th](http://hackage.haskell.org/package/timezone-olson-th)
19+package for a way to include timezone informaton from a binary Olson
20+timezone file at compile time.
21+
22+Copyright (c) 2010-2018 Yitzchak Gale. All rights reserved.
1523
16−Copyright (c) 2010 Yitzchak Gale. All rights reserved.
1724For licensing information, see the BSD3-style license in the file
1825LICENSE that was originally distributed by the author together with
1926this file.
2027
21−This package is part of the time-ng project:
22−http://projects.haskell.org/time-ng/
23−
24−Send suggestions, bug reports, and patches to:
25−yitz@community.haskell.org
26−
27−INSTALLATION:
28−
29−To install the latest version of this package, make sure that
30−cabal-install is installed on your system (it is if you have installed
31−the Haskell Platform) and type the commands:
32−
33−cabal update
34−cabal install timezone-olson
28+This package is part of the [time-ng project](http://projects.haskell.org/time-ng/).
3529
36−TESTING UTILITIES:
30+## Testing utilities
3731
3832This package also provides two Haskell files, each of which can be
3933compiled into a command-line utility that might be helpful for testing
timezone-olson.cabal+21−52
@@ -1,76 +1,45 @@
1−-- timezone-olson.cabal auto-generated by cabal init. For additional
2−-- options, see
3−-- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.
4−-- The name of the package.
51Name: timezone-olson
6−
7−-- The package version. See the Haskell package versioning policy
8−-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
9−-- standards guiding when and how versions should be incremented.
10−Version: 0.1.5
11−
12−-- A short (one-line) description of the package.
2+Version: 0.1.9
133Synopsis: A pure Haskell parser and renderer for binary Olson timezone files
14−
15−-- A longer description of the package.
164Description: A parser and renderer for binary Olson timezone
175 files whose format is specified by the tzfile(5)
186 man page on Unix-like systems. For more
197 information about this format, see
20− <http://www.twinsun.com/tz/tz-link.htm>. Functions
21− are provided for converting the parsed data into
8+ <http://www.iana.org/time-zones/repository/tz-link.html>.
9+ Functions are provided for converting the parsed data into
2210 'TimeZoneSeries' objects from the timezone-series
2311 package. On many platforms, binary Olson timezone
2412 files suitable for use with this package are
2513 available in the directory /usr/share/zoneinfo
2614 and its subdirectories on your computer.
27−
28−-- URL for the project homepage or repository.
15+ For a way to read binary Olson timezone files at compile
16+ time, see the timezone-olson-th package
17+ (<http://hackage.haskell.org/package/timezone-olson-th>).
2918Homepage: http://projects.haskell.org/time-ng/
30−
31−-- The license under which the package is released.
3219License: BSD3
33−
34−-- The file containing the license text.
3520License-file: LICENSE
36−
37−-- The package author(s).
3821Author: Yitzchak Gale
39−
40−-- An email address to which users can send suggestions, bug reports,
41−-- and patches.
42−Maintainer: yitz@community.haskell.org
43−
44−-- A copyright notice.
45−Copyright: Copyright (c) 2010 Yitzchak Gale. All rights reserved.
46−
22+Maintainer: yitz@sefer.org
23+Copyright: Copyright (c) 2010-2018 Yitzchak Gale. All rights reserved.
4724Category: Data
48−
4925Build-type: Simple
26+Extra-source-files: README.md, catTZ.hs, hzdump.hs
27+Cabal-version: >=1.10
28+Tested-with: GHC > 8.0 && < 8.5
5029
51−-- Extra files to be distributed with the package, such as examples or
52−-- a README.
53−Extra-source-files: README, catTZ.hs, hzdump.hs
54−
55−-- Constraint on the version of Cabal needed to build this package.
56−Cabal-version: >=1.2
57−
30+Source-repository HEAD
31+ type: git
32+ location: https://github.com/ygale/timezone-olson.git
5833
5934Library
60− -- Modules exported by the library.
61− Exposed-modules: Data.Time.LocalTime.TimeZone.Olson, Data.Time.LocalTime.TimeZone.Olson.Parse, Data.Time.LocalTime.TimeZone.Olson.Render, Data.Time.LocalTime.TimeZone.Olson.Types
62−
63− -- Packages needed in order to build this package.
35+ Default-language: Haskell2010
36+ Exposed-modules: Data.Time.LocalTime.TimeZone.Olson
37+ , Data.Time.LocalTime.TimeZone.Olson.Parse
38+ , Data.Time.LocalTime.TimeZone.Olson.Render
39+ , Data.Time.LocalTime.TimeZone.Olson.Types
6440 Build-depends: base >= 3.0 && < 5.0,
6541 timezone-series >= 0.1.0 && < 0.2,
66− time >= 1.1.4 && < 1.5,
67− binary >= 0.4.1 && < 0.8,
42+ time >= 1.6 && < 1.10,
43+ binary >= 0.4.1 && < 0.9,
6844 bytestring >= 0.9 && < 1.0,
6945 extensible-exceptions >= 0.1.0 && < 0.2
70−
71− -- Modules not exported by this package.
72− -- Other-modules:
73−
74− -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source.
75− -- Build-tools:
76−