[snip]
It is always a problem to lump things with different semantics into the same type :-) What I'm arguing is that there should be only one fixed-duration offset datatype and it should be in terms of (seconds, picoseconds). Other fixed durations can be easily defined in terms of this datatype. I'm still not sure that you actually want base-dependent offsets, but again they can be easily defined on top of the fixed duration datatype. And they should be specified separately from the base functionality. [snip]
I wrote a reply, but I don't really have anything new to say over what's been said already, so I'll keep it brief instead. The copy of ISO8601 that I looked at is here: http://www.astroclark.freeserve.co.uk/iso8601/index.htm, but from what you said I'm guessing you're looking at a different version. Anyway, to sum up: - I agree that there should be a constant-duration time offset type. However, TimeDiff does actually fuction perfectly well as one at the moment, since diffClockTimes only fills in the seconds and picoseconds fields. - I believe a reasonable interpretation of the other fields of TimeDiff is as base-dependent offsets. The current implementation in GHC doesn't do this, but you can use TimeExts which does. - Our implementation of ClockTime uses C's gettimeofday(), which apparently is based a broken definition of the epoch. Oh well :-) Cheers, Simon
SM> I wrote a reply, but I don't really have anything new to say over what's SM> been said already, so I'll keep it brief instead. The copy of ISO8601 SM> that I looked at is here: SM> http://www.astroclark.freeserve.co.uk/iso8601/index.htm, but from what SM> you said I'm guessing you're looking at a different version. Oops, I guess I did. However, the 2000 version does not clarify matters much more. It does, however, make the distinction between day (= 24 hours) and calendar day (period until the same daytime is reached again). Regarding, time periods it only specifies the syntax, not the semantics. Oh well. SM> Anyway, to sum up: SM> - I agree that there should be a constant-duration time offset type. SM> However, TimeDiff does actually fuction perfectly well as one at SM> the moment, since diffClockTimes only fills in the seconds and SM> picoseconds fields. Ok. But there is the caveat that TimeDiff { ... tdSec :: Int ... } which will give rise to overflows in a few years. SM> - I believe a reasonable interpretation of the other fields of SM> TimeDiff is as base-dependent offsets. The current implementation SM> in GHC doesn't do this, but you can use TimeExts which SM> does. In addition, it does not muddle months, years, etc together into one TimeDiff value. This is a GOOD THING because you would have to specify the sequence in which the various items are added to the reference to get a well-defined behavior. SM> - Our implementation of ClockTime uses C's gettimeofday(), which SM> apparently is based a broken definition of the epoch. Oh well :-) IMHO, the TimeDiff data type is the source of all evil (in Time, at least). What about the following proposal for extending TimeExts: * Add a datatype data Duration = Duration Integer Integer * Define the operations addToClockTime :: Duration -> ClockTime -> ClockTime diffClockTimes :: ClockTime -> ClockTime -> Duration [[ and deprecate using them from Time ]] * Write an explicit specification for the remaining operators. This should not be much effort. [the overall goal being, of course, to phase out the Time module] For further cleanup, the stuff dealing with CalendarTime could be moved into its own module Calendar. And it would be very useful to have parsing functions like parseTime :: String -> CalendarTime [might have to be IO CalendarTime because the interpretation depends on the local time zone, etc] Cheers -Peter
(Shouldn't this move to haskell-lib?) On Tue, Feb 11, 2003 at 12:51:13PM -0800, Peter Thiemann wrote:
... IMHO, the TimeDiff data type is the source of all evil (in Time, at least). What about the following proposal for extending TimeExts: * Add a datatype data Duration = Duration Integer Integer ...
What are the two fields?
participants (3)
-
Dylan Thurston -
Peter Thiemann -
Simon Marlow