@hackage leapseconds-announced2017
Leap seconds announced at library release time.
Categories
License
BSD-3-Clause
Maintainer
bjorn@buckwalter.se
Links
Versions
- 2017.1.0.1 Sun, 30 Jul 2017
- 2017.1 Thu, 8 Dec 2016
- 2017.0.0.1 Wed, 7 Dec 2016
- 2017 Wed, 13 Jul 2016
- 2015.0.0.1 Mon, 18 May 2015
- 2015 Wed, 7 Jan 2015 Show all…
Installation
Dependencies (2)
Dependents (1)
@hackage/acme-everything
leapseconds-announced
This libraray provides a static Data.Time.Clock.TAI.LeapSecondTable
"containing" the leap seconds announced at library release time.
A new version of the library is released every time the International
Earth Rotation and Reference Systems Service (IERS) announces a new
leap second at http://hpiers.obspm.fr/eoppc/bul/bulc/bulletinc.dat.
This module is intended to provide a quick-and-dirty leap second solution for one-off analyses concerned only with the past and present (i.e. up until the next as of yet unannounced leap second), or for applications which can afford to be recompiled against an updated library as often as every six months.
Usage
Import Data.Time.Clock.AnnouncedLeapSeconds
to bring the leap
second table lst
into scope. Here is a usage example:
import Data.Time
import Data.Time.Clock.TAI
import Data.Time.Clock.AnnouncedLeapSeconds
-- | Convert from UTC to TAI.
utcToTAITime' = utcToTAITime lst
-- | Convert from TAI to UTC.
taiToUTCTime' = taiToUTCTime lst
-- | Add a length of time to a UTC time, respecting leap seconds
-- (as opposed to Data.Time.Clock.addUTCTime).
addUTCTime' :: DiffTime -> UTCTime -> UTCTime
addUTCTime' dt = taiToUTCTime' . addAbsoluteTime dt . utcToTAITime'