timezone-detect: Haskell bindings for the zone-detect C library; plus tz-aware utils.

[ data, foreign, gpl, library, time ] [ Propose Tags ]

Modules

[Last Documentation]

  • Data
    • Time
      • LocalTime
        • TimeZone
          • Data.Time.LocalTime.TimeZone.Detect
  • Foreign
    • Foreign.ZoneDetect

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.2.0.0, 0.2.1.0, 0.2.2.0, 0.3.0.0, 0.3.0.1
Change log ChangeLog.md
Dependencies base (>=4.9 && <4.14), time (>=1.9.1 && <=1.10), timezone-olson (>=0.2.0 && <0.3), timezone-series (>=0.1.0 && <0.2) [details]
License GPL-2.0-only
Author Luis Borjas Reyes
Maintainer timezone-detect@lfborjas.com
Revised Revision 1 made by lfborjas at 2020-08-30T18:39:55Z
Category Data, Foreign, Time
Home page https://github.com/lfborjas/timezone-detect#readme
Bug tracker https://github.com/lfborjas/timezone-detect/issues
Source repo head: git clone https://github.com/lfborjas/timezone-detect
Uploaded by lfborjas at 2020-08-30T18:32:35Z
Distributions
Downloads 891 total (15 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2020-08-30 [all 2 reports]

Readme for timezone-detect-0.2.0.0

[back to package description]

TimezoneDetect

build

Haskell bindings to the excellent ZoneDetect library, plus additional UNIX-aware facilities to determine the UTC time of a given local time in a latitude and longitude.

Usage

You'll need timezone database files to work with this library, see instructions in the original repository.

Once you have those files in hand, you'll be able to get a timezone from a given latitude and longitude:

>>> lookupTimeZoneName "./test/tz_db/timezone21.bin" 40.7831 (-73.9712) :: Maybe TimeZoneName
Just "America/New_York"

Additionally, we now depend on the timezone-series and timezone-olson packages to add awareness of tz database information.

With that, you can look up the UTC time at a point in time and space:

>>> import Data.Time
>>> localWinter <- parseTimeM True defaultTimeLocale "%Y-%-m-%-d %T" "2019-12-25 00:30:00"
>>> utcTime <- timeAtPointToUTC "./test/tz_db/timezone21.bin" 40.7831 (-73.9712) localWinter
2019-12-25 05:30:00 UTC

>>> localSummer <- parseTimeM True defaultTimeLocale "%Y-%-m-%-d %T" "2019-07-25 00:30:00"
>>> utcTime <- timeAtPointToUTC "./test/tz_db/timezone21.bin" 40.7831 (-73.9712) localWinter
2019-12-25 04:30:00 UTC