Time library underspecified

Peter Thiemann thiemann@informatik.uni-freiburg.de
Thu, 14 Nov 2002 09:57:48 +0100


Did anyone try to use the standard Time library that comes with Haskell 
for a serious purpose?

I wanted to, but came across the problem that the TimeDiff data type is 
underspecified. For example, what is the official way to convert a 
TimeDiff value into seconds? The problematic parts are:
* how many days for one tdYear (365, 366)
* how many days for one tdMonth (28,29,30,31)
* how many seconds for one tdMin (given the presence of leap seconds)^(1)
Actually, once the absolute reference of the TimeDiff is lost, then it
is impossible to recover leap years and leap seconds, so TimeDiff
better had to account for them somehow. I suppose, the best would be
to just have diffClockTimes return the number of seconds as an Integer.

Since Simon PJ has finished editing the library report, who's now in 
charge of keeping track of problems with it and perhaps writing a 
commentary in cases such as this?

Cheers
-Peter

(1) for this one, there is reasonable consensus. for example the ISO 
8601 standard (representation of dates and times) defines minute=60 
seconds, hour=60 minutes, day=24 hours. However, this leads to the 
strange(?) situation that the difference between
1998-12-31T12:00:00 and 1999-01-01T12:00:00
is 1 day and one second. (There was a leap second on that night

               1998 December 31   23h   59m   59s
               1998 December 31   23h   59m   60s
               1999 January  01    0h    0m    0s

see http://tycho.usno.navy.mil/leap.html)