X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fstrset%2Ftools%2Fcbspeed.c;h=3018da9806daec0c404f2c6b245afccd20505c26;hp=a1766490341d2acade525dd419ffbd5184e10f3e;hb=c0117ccb503af9b067695441199a71db8846a296;hpb=beb01ef8986c8957da74d3ca2a13d48a08277be6 diff --git a/ccan/strset/tools/cbspeed.c b/ccan/strset/tools/cbspeed.c index a1766490..3018da98 100644 --- a/ccan/strset/tools/cbspeed.c +++ b/ccan/strset/tools/cbspeed.c @@ -381,23 +381,17 @@ return allprefixed_traverse(top,handle,arg); /* end critbit */ /* Nanoseconds per operation */ -static size_t normalize(const struct timeval *start, - const struct timeval *stop, +static size_t normalize(const struct timespec *start, + const struct timespec *stop, unsigned int num) { - struct timeval diff; - - timersub(stop, start, &diff); - - /* Floating point is more accurate here. */ - return (double)(diff.tv_sec * 1000000 + diff.tv_usec) - / num * 1000; + return time_to_nsec(time_divide(time_sub(*stop, *start), num)); } int main(int argc, char *argv[]) { size_t i, j, num; - struct timeval start, stop; + struct timespec start, stop; critbit0_tree ct; char **words, **misswords;