Concerning Time.TimeDiff

John Meacham john@repetae.net
Wed, 18 Jun 2003 13:13:10 -0700


I thought about this too, in my opinion converting to a CalendarTime is
'logically' functional in that the only reason the conversion would ever
vary is with incomplete information and an approximation in the first
place. if we consider the table of leap seconds to be an 'oracle' which
is complete (which is the useful approximation to reality most
applications can assume) then it IS a purely functional operation.

what is very much needed is a:

clockTimeToTZCalendarTime :: TimeZone -> ClockTime -> CalendarTime

where TimeZone must contain at least 'UTC' and 'TAI'
clockTimeToUTCTime is just a specialization of this function. Not sure
whether TAI is currently a supported timezone, but we should make it a
requirement since it is by far the easiest to convert to and guarenteed
to be unambiguous no matter how complete the leap second tables are.

        John

On Wed, Jun 18, 2003 at 07:17:32PM +0200, Dylan Thurston wrote:
> On Wed, Jun 18, 2003 at 11:22:55AM +0100, Simon Marlow wrote:
> > -- | Convert a 'ClockTime' to a 'CalendarTime' in the current timezone
> > clockTimeToCalendarTime :: ClockTime -> IO CalendarTime
> > 
> > -- | Convert a 'ClockTime' to a 'CalendarTime' in UTC
> > clockTimeToUTCTime :: ClockTime -> CalendarTime
> 
> clockTimeToUTCTime also needs to return IO CalendarTime, since it will
> certainly need to look up a table of leap seconds.
> 
> Peace,
> 	Dylan



-- 
---------------------------------------------------------------------------
John Meacham - California Institute of Technology, Alum. - john@foo.net
---------------------------------------------------------------------------