tai-0: Support library to enable TAI usage on systems with time kept in UTC.

Safe HaskellNone
LanguageHaskell2010

Data.Time.Clock.TAI.Support

Synopsis

Documentation

data TAISync Source #

Our data about TAI in relation to UTC and this system.

type UpdatePolicy = IO (IORef LeapSecondList) Source #

A function that enacts the periodic update of the LeapSecondList leap second data. Usually periodicBackgroundDownload will satisfy a user's needs, but some enviroments may want another policy.

initSync :: MonadIO m => UpdatePolicy -> m TAISync Source #

Given an UpdatePolicy, generate a TAISync to be used to interact with TAI though the other library functions.

getTAI :: MonadIO m => TAISync -> m AbsoluteTime Source #

Get the current TAI time.

absGuessUtc :: MonadIO m => TAISync -> AbsoluteTime -> m UTCTime Source #

Given our information about leap seconds, generate a UTC time from a TAI time as a total function. As the relation between TAI is only known for a specific time range, we give a best-guess outside said time range. Specificly we only know the offset after some point in the past, and up to about 6 months into the future. Outside this range we assume the last known mapping between UTC and TAI doesn't drift.

utcGuessAbs :: MonadIO m => TAISync -> UTCTime -> m AbsoluteTime Source #

Given our information about leap seconds, generate a TAI time rom a UTC time as a total function. As the relation between TAI is only known for a specific time range, we give a best-guess outside said time range. Specificly we only know the offset after some point in the past, and up to about 6 months into the future. Outside this range we assume the last known mapping between UTC and TAI doesn't drift.

currentLeapMap :: MonadIO m => TAISync -> m LeapSecondMap Source #

Gets the current leap second data in a time compatable form.

periodicBackgroundDownload :: LeapSources -> Int -> Int -> UpdatePolicy Source #

Update the leap second table by redownloading the tables periodicly in the background. This policy uses the TimeoutManager to check for a new table every dbetween days, trying again dretry if there is a failure. Recomended values are 30 and 1 for these. Given the validity period for leap second data, this should generally suffice. There can be problems with local files being near their expiration though.

This policy requires a threaded runtime.