RFC: Time Library 0.1

Ashley Yakeley ashley at semantic.org
Wed Jul 6 04:38:12 EDT 2005

In article <20050705230703.GA26379 at momenergy.repetae.net>,
 John Meacham <john at repetae.net> wrote:

> It needs a 
> getTAItime :: IO AbsoluteTime
> and  a 
> getLeapSecondTable :: IO LeapSecondTable 
> Many systems have ways to get at these and it would be a travesty if we
> didn't fix this hole in the API when we have the chance. As always, the
> library should make its best effort to get at this info.

How do I implement these?

> Also, it would be nice if the LeapSecondTable was not a functional type,
> but rather something with structure, like a list of (year,offset) pairs.
> There could be apps that will have to look at which years the leap
> seconds actually occured in and probing the function with every possible
> value in its domain is not very fun.

That's a good question. I used a function because that's the "least" 
type necessary to do the conversions, at the same time allowing 
estimates extending infinitely into the future (and past, if we want 
"proleptic UTC"). A list of pairs would have to be walked through, in 
effect converted to the function type.

> Also, shouldn't AbsoluteTime be an instance of several Num classes? 

No, I don't think any Num functions apply. There's no "zero time" and 
you can't meaningfully add 3am today to 7pm tomorrow.

> What units does DiffTime have?

Seconds, and I'll add that to the doc.

> is it relative, or is the length of
> a DiffTime independent of what you do to it?

A DiffTime is always real absolute seconds such as a good clock might 
measure, independent of whatever the earth might be doing.

Ashley Yakeley, Seattle WA

More information about the Libraries mailing list