On Dec 27, 2006, at 06:29, Poul-Henning Kamp wrote:
> That's a pretty bad format. Computers are binary and having
> pseudo-decimal fields like tv_usec in timeval, tv_nsec in timespec
> and picoseconds in Haskell is both inefficient and stupid.
>
> The fractional part should be a binary field, so that the width
> can be adjusted to whatever precision and wordsize is relevant.
It's impossible to accurately represent a millisecond using binary
fractions. That would be unacceptable for most sub-second use.
A better idea might have been to use Haskell's "Rational" type for
the seconds offset, which is stored as two integers (for numerator
and denominator). Instead I used a fixed-point type (internally just
an integer from 0 to 86400999999999999). It does not separate
"integer" and "decimal" part.
--
Ashley Yakeley
Received on Wed Dec 27 2006 - 14:29:43 PST