In message <[EMAIL PROTECTED]>, Ashley Yakeley writes: >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.
Reality check: with a 32bit fraction, the error would be 69 ps. >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. Yes, let us make it as expensive as possible to operate on timestamps, so that everybody will have to invent their own faster type. NOT! -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [EMAIL PROTECTED] | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.