Parsing date and time specifications

Peter Simons simons@cryp.to
19 Dec 2002 20:51:22 +0100


Hi,

I have written a parser that turns an RFC2822 date and time
specification into a datatype usable in Haskell. While the parser is
working just fine so far, I have a problem with the CalendarTime
datatype. It appears that in order to construct one of those, I need
_all_ the information it contains, including the weekday (Day) and the
number of the day in the year.

The problem now is that I do not have this information! Of course I
could calculate these values by hand, but this is immensely
complicated. 

I thought about using a TimeDiff instead, but apparently the functions
provided in the Prelude do not handle TimeDiff for anything except for
"maths" -- what doesn't really help me for what I am trying to do.

I briefly looked at the Posix module that comes with GHC as well, and
which seems to provide CTime. But then, the Posix module appears to be
non-standard. *sigh*

Any suggestions what I could do?

        -peter