bugs in Time.hs
Ross Paterson
ross@soi.city.ac.uk
Tue, 26 Aug 2003 21:38:32 +0100
On Tue, Aug 26, 2003 at 05:53:32PM +0200, Härmel Nestra wrote:
> I found several divergences of the module Time of Hugs (v. Nov
> 2002 for Linux) from the Haskell Report which can't be found neither
> in the list of known Hugs bugs nor in the list of differences from
> Haskell 98 (the latter is also too old and claims that Time is not
> yet available).
Thanks for the bug report.
> 1. The report specifies that the field ctSec of datatype
> CalendarTime must be exported outside the module. In Hugs, this field
> is missing from the exports list.
This is already fixed in the development version, which uses the same
Time module as GHC.
> 2. The report requires (see the end of the penultimate paragraph
> before the library starts) that " toClockTime l converts l [...]
> ignoring the contents of the ctWDay , ctYDay , ctTZName , and
> ctIsDST fields". Hugs, however, does not ignore ctIsDST .
It is wierd: it constructs an argument using ctIsDST, and then the
primitive evaluates that argument but ignores its value. I'll remove
the argument from the primitive.
> 3. Additionally, the behaviour of the function diffClockTime is
> strange in Hugs. In the returned record, at most two fields are
> non-zero: tdSec and tdPicosec . Thereby, tdSec is of type Int
> which leads to incorrect value in the case of big time differences.
> The report is amazingly tongue-tied at this point, so it is even
> difficult to argue that your implementation is diverging. It seems
> natural to think however that this behaviour is not what was expected.
Unfortunately this (tdSec::Int) is a known bug in the Haskell 98 Report,
which we must slavishly follow.
> 4. There seem to be problems with dates before year 1970.
That sounds like a Posix problem.