RFC: Time Library 0.1

Ashley Yakeley ashley at semantic.org
Thu Jul 7 04:21:19 EDT 2005


In article <20050706220345.GE26379 at momenergy.repetae.net>,
 John Meacham <john at repetae.net> wrote:

> I was thinking for the initial implementation
> 
> getTAITime = do
>         lst <- getLeapSecondTable 
>         t <- getCurrentTime
>         return (utcToTAITime lst t)

The problem with this is that it will re-fetch the leap-second table 
with every call, at the very least, re-examining the file to see whether 
it's changed.
       
> getLeapSecondTable = do
>         -- check for /etc/leapseconds.txt
>         -- return contents of file if it exists
>         -- else, return built in table. 

Returning a built-in table is worse than useless, as any program 
compiled with it will soon break.

We could however check for /etc/leapseconds.txt, that might be useful. 
But it's not clear what the behaviour on Windows or other platforms 
should be. What I'd really like to see is an established cross-platform 
convention for providing leap-second tables, and then we could interface 
to that.

What I am tempted to do is something like this:

readLeapSecondTable :: FilePath -> IO LeapSecondTable

> Of course, getLeapSecondTable and getTAITime will be modified to use any
> local interfaces available or when POSIX eventually specifies some TAI
> interface functions. 

What do you mean by "modified to use any local interfaces available"? 
Certainly if POSIX does some work here we can provide functions then.

-- 
Ashley Yakeley, Seattle WA



More information about the Libraries mailing list