Re: Question about the taia library interface
"Brian D. Winters" <[email protected]> Tue, 9 Mar 2010 17:54:47 -0800
| Newsgroups | gmane.comp.lib.libtai |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Mar 09, 2010 at 02:45:47PM -0500, Jay Sullivan wrote:
> According to http://cr.yp.to/libtai/tai.html, "A struct tai value is
> an integer between 0 inclusive and 2^64 exclusive." This makes sense.
> For example, djbdns includes tai.h that defines struct tai as:
>
> struct tai {
> uint64 x;
> };
>
> According to http://cr.yp.to/libtai/taia.html, "A struct taia value is
> a number between 0 inclusive and 2^64 exclusive." I don't understand
> this.
> For example, djbdns includes taia.h that defines struct taia as:
>
> struct taia {
> struct tai sec;
> unsigned long nano;
> unsigned long atto;
> };
>
>
> How can both statements be true if a struct taia contains a struct tai
> within it? Shouldn't a struct taia be defined to be "a number between
> 0 inclusive and 2^128 exclusive"? (or perhaps some other exponent..)
Mentally insert a decimal point between the struct tai and the
unsigned longs. You still have a number (not an integer, but a
number) of seconds in the range [0,2^64). A struct taia has a
fractional part, which a struct tai (an integer number of seconds)
lacks.
Brian