In message <c636b079.7d49%james.p....@jpl.nasa.gov>, "Lux, James P" writes:
>An integer divide in software is quite fast >(unless you're working with something like a Z80). You only need to divide when you want to change your estimate of the counters range, for generating timestamps a multiplication will do. >There's no real advantage in having "hardware" count seconds.. It takes more >gates to count by arbitrary N than 2^M. Not only that, it makes the calculation of timeintervals as differences between two timestamps a royal mess: #define timersub(tvp, uvp, vvp) \ do { \ (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ if ((vvp)->tv_usec < 0) { \ (vvp)->tv_sec--; \ (vvp)->tv_usec += 1000000; \ } \ } while (0) -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 p...@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. _______________________________________________ time-nuts mailing list -- time-nuts@febo.com To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts and follow the instructions there.