
On 02 February 2005 07:25, Ashley Yakeley wrote:
In article
, Ashley Yakeley wrote: It looks like we may need three types here:
* one for TAI
* one for POSIX time, which is a broken encoding of UTC
* one for correct encoding of UTC
This is the sort of thing I mean:
newtype TAITime = TAITime Integer deriving (...)
newtype POSIXTime = POSIXTime Integer deriving (...)
newtype DiffTime = DiffTime Integer deriving (...)
type JulianDay = Integer
data UTCTime = UTCTime JulianDay DiffTime
getCurrentTime :: IO POSIXTime
posixToUTCTime :: POSIXTime -> UTCTime
Why does the user of the library care about the difference between UTC, TAI and POSIX time? The only way I can think that this really needs to be exposed to the programmer is so that they can tell the library whether the system clock is running POSIX or TAI time. For the library API, a single notion of time is sufficient, no? Cheers, Simon