X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/f29b38ef2a056daa14bbfda2fce78063faa773d4..5279f43fc9be71815091e79c76d5bc04c8c88421:/timer.h?ds=sidebyside 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)); }