
What underlying numerical type should be used to store TAI and UTC types, and at what resolution? newtype Clocktime = Clocktime ??? deriving (Eq,Ord, ...) Here are some suggestions. Not all of them are good ones: * Integer, where 1 = 1 microsecond, nanosecond, picosecond But which? Current ClockTime is ps. POSIX "struct timeval" is micro-s, "struct timespec" is ns. TAI64NA uses attoseconds (10^-18 s). http://cr.yp.to/libtai/tai64.html + fast(?) + power of ten matches common practice - whatever resolution might not be enough * Integer, where 1 = 1 Planck time (c. 5*10^-44 s) + amusing + unlikely to ever need more accuracy - number of Planck times in an SI second not precisely known - not a power of ten - about 2*10^31 in a picosecond, or about 100 bits * Fixed-size integer type, where 1 = 1 microsecond or etc. 2^64 mus = 580,000 years 2^64 ns = 580 years 2^128 ps = 10^19 years + fast(?) - probably need Int128 * Rational, where 1 = 1 second + 1 = 1 second easy to use + all the resolution you need + no error when dividing, guarantee (a / b) * b == a - might be slower? * Fixed-point type, where 1 = 1 second This could be Integer at some power of ten. + 1 = 1 second easy to use - we'd have to create it - whatever resolution might not be enough * Floating-point type, where 1 = 1 second + 1 = 1 second easy to use + fair amount of resolution + can use sqrt and trig functions easily + fancy NaN values, signed zeros and infinities - resolution variable, bad use of floating point * Type parameter, where 1 = 1 second + flexible - extra complication - can't use directly with Integer except for 1-second resolution -- Ashley Yakeley, Seattle WA