From: Arnaud Giersch Date: Tue, 22 Jan 2019 13:34:56 +0000 (+0100) Subject: Convert clock_type to enum class. X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/20ee10ed13aee7d9fb9c844648d5159ed4a054d2 Convert clock_type to enum class. --- diff --git a/main.cpp b/main.cpp index af47c64..64fa49f 100644 --- a/main.cpp +++ b/main.cpp @@ -201,8 +201,8 @@ int main(int argc, char* argv[]) { int exit_status = 0; // global exit status double simulated_time = -1.0; - timestamp elapsed_time(timestamp::wallclock_time); - timestamp simulation_time(timestamp::cpu_time); + timestamp elapsed_time(timestamp::clock_type::WALLCLOCK); + timestamp simulation_time(timestamp::clock_type::CPU); msg_error_t res; elapsed_time.start(); diff --git a/timer.h b/timer.h index 52502a1..9f00cd2 100644 --- a/timer.h +++ b/timer.h @@ -31,7 +31,7 @@ struct timespec operator-(const struct timespec& a, const struct timespec& b) class timestamp { public: - enum clock_type { wallclock_time, cpu_time }; + enum class clock_type { WALLCLOCK, CPU }; timestamp(clock_type ct); ~timestamp(); @@ -103,11 +103,11 @@ inline void timestamp::get_time(struct timespec& tv) { switch (clk) { - case cpu_time: { + case clock_type::CPU: { clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tv); break; } - case wallclock_time: + case clock_type::WALLCLOCK: #ifdef CLOCK_MONOTONIC_RAW clock_gettime(CLOCK_MONOTONIC_RAW, &tv); #else