X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/f29b38ef2a056daa14bbfda2fce78063faa773d4..6f5ec5fdc42f96a8fe95f4b846b163d4dc92e0c8:/timer.h diff --git a/timer.h b/timer.h index 6ae15eb..dbf32e1 100644 --- a/timer.h +++ b/timer.h @@ -28,7 +28,7 @@ struct timeval operator+(const struct timeval& a, const struct timeval& b) inline struct timeval operator-(const struct timeval& a, const struct timeval& b) { - timeval result; + struct timeval result; result.tv_sec = a.tv_sec - b.tv_sec; result.tv_usec = a.tv_usec - b.tv_usec; if (result.tv_usec < 0) { @@ -38,7 +38,7 @@ struct timeval operator-(const struct timeval& a, const struct timeval& b) return result; } -double timertod(const timeval& a) +double timertod(const struct timeval& a) { return a.tv_sec + a.tv_usec / 1e6; } @@ -66,12 +66,12 @@ public: void start() { - getrusage(RUSAGE_SELF, &before); + getrusage(RUSAGE_SELF, &before); } void stop() { - getrusage(RUSAGE_SELF, &after); + getrusage(RUSAGE_SELF, &after); difference = difference + ((after.ru_utime + after.ru_stime) - (before.ru_utime + before.ru_stime)); }