
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

In article
<3429668D0E777A499EE74A7952C382D1031588A4@EUR-MSG-01.europe.corp.microso
ft.com>,
"Simon Marlow"
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?
These are the other options: * Not deal with TAI at all If we can assume that gettimeofday returns what POSIX says it's supposed to, then we don't need TAI. This means not providing any help to people who have some other reason to need TAI. * Have a single type that represents both TAI and UTC naively This means a single value in the type represents two different actual times, depending on whether it's interpreted as TAI or as UTC. * Have a single type that represents time, with various functions for getting TAI and UTC representations This can't be done, since we don't know future leap-seconds. -- Ashley Yakeley, Seattle WA
participants (2)
-
Ashley Yakeley
-
Simon Marlow