Bug in Time module
Simon Marlow
simonmar at microsoft.com
Wed Sep 26 11:48:30 EDT 2001
> | I'm not sure it's a bug - Haskell 98 doesn't require
> | that the TimeDiff value returned from diffClockTimes
> | is normalised in any way, and it can't be done in
> | general of course because months and years have
> | different numbers of days, even minutes have different
> | numbers of seconds if leap seconds are taken into
> | account.
>
> You are absolutely right of course. Shouldn't this be
> regarded as a bug in the Haskell'98 spec then? It is not
> sure to me at all what a value of TimeDiff really means.
Well, there are two aspects to TimeDiff:
1. addToClockTime t1 (diffClockTimes t1 t2) == t2
(the report should probably specify this)
2. Being able to do things like
addToClockTime t1 noTimeDiff{tdYear=1}
to increase the year by one. (noTimeDiff doesn't
exist in Haskell 98, but it's easy to define).
Note that certain uses of addToClockTime may be undefined - eg. what
does it mean to add one month to 31 January? I remember having a long
discussion about this a while back, with the result that we now have the
TimeExts library which supposedly implements a saner kind of time
difference. The previous discussion should be in the archives.
Cheers,
Simon
More information about the Glasgow-haskell-bugs
mailing list