In message <20061227131332.GA24328_at_fysh.org>, Zefram writes:
>Ashley Yakeley wrote:
>>In the Haskell time library, I represent UTC time by what seemed to
>>me the simplest possible correct type. This is a record containing an
>>integer to represent day number (as MJD), and a fixed-point decimal
>>(picosecond resolution) to represent seconds since midnight. The
>>allowed range for this is 0 to 86400.999999999999.
>
>That's a pretty good format.
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.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Received on Wed Dec 27 2006 - 06:39:26 PST