]> rtime.felk.cvut.cz Git - frescor/frsh.git/commitdiff
renegobench: Fixed timespec substraction
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 15 Oct 2009 15:36:54 +0000 (17:36 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 15 Oct 2009 15:36:54 +0000 (17:36 +0200)
frsh_api/tests/renegobench.c

index c3ebecccac3f4a345c258a82d87270d830498226..62b0e6336058cc9dfd627d6671b744acfd660eaf 100644 (file)
@@ -52,7 +52,10 @@ int main(int argc, char *argv[])
                ret = frsh_contract_renegotiate_sync(&contract[i], vres[i]);
                if (ret) PERROR_AND_EXIT(ret, "frsh_contract_renegotiate_sync");
                clock_gettime(CLOCK_MONOTONIC, &t_end);
-               printf("%d %g\n", i, (float)(t_end.tv_sec+1e-9*t_end.tv_nsec) - (t_start.tv_sec+1e-9*t_start.tv_nsec));
+               uint64_t ns;
+               ns = (uint64_t)(t_end.tv_sec - t_start.tv_sec)*1000000000;
+               ns += t_end.tv_nsec - t_start.tv_nsec;
+               printf("%d %d.%09d\n", i, (int)(ns/1000000000), (int)(ns%1000000000));
        }
        /* Cancel N contracts */
        for (i=0; i<N; i++) {