RFC: Time Library 0.3

Ashley Yakeley ashley at semantic.org
Mon Feb 6 03:00:44 EST 2006

Please take a look at my third draft of a replacement for the standard 
time library.

Take a look at the Haddock documentation:

Download the source:

Or keep up-to-date:
darcs get http://semantic.org/TimeLib/TimeLib/

It needs GHC 6.4.1. (I haven't tested with 6.4 or other compilers.) It 
consists of two separate Cabal packages, "fixed" and "time", which can 
be installed in the usual way. See the README file.

This release should be close to being ready to become part of the 
libraries distributed with some future version of GHC. I'm interested in 
any remaining issues.

Major changes since 0.2:

* The code has been reorganised into two separate packages, "fixed", 
containing only Data.Fixed for fixed-point arithmetic, and "time", 
containing everything else.

* The modules in "time" have been reorganised. The three "first level" 
modules, Data.Time.*, contain functionality that most ordinary users 
want. The "root" module, Data.Time simply re-exports these three. The 
"second level" modules, Data.Time.*.*, contain more specialised 

Some points (largely repeated from the 0.2 RFC):

1.  There is no leap second table provided, though there is a type 
(LeapSecondTable) for such things. Any software compiled with a fixed 
table would soon become out of date.

2. There is no table of time-zones provided, since these also change. 
However, if there's a good way of getting this from the TZ database on 
the machine, I'll add that.

It is actually possible to get the local time-zone for any given time, 
indeed one of the test programs finds your local summertime transitions. 
The Timezone type includes name, minutes of offset, and a "summertime" 

3. The TimeLocale type comes from the already existing System.Locale.

4. The "fixed" package includes Data.Fixed which provides a fixed-point 
arithmetic type (wrapper around Integer). It allows dealing with seconds 
as a single thing, rather than as an integer/picoseconds pair. It should 
probably be merged into base.

5. I don't have any text-parsing functionality for times. This is a fair 
amount of work, so it would be good to know sensible requirements.

6. Time as measured by the CPU since system startup remains in 
System.CPUTime, which TimeLib does not intend to replace.

Ashley Yakeley, Seattle WA

More information about the Libraries mailing list