]> AND Private Git Repository - loba.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Convert clock_type to enum class.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 22 Jan 2019 13:34:56 +0000 (14:34 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Tue, 22 Jan 2019 13:34:56 +0000 (14:34 +0100)
main.cpp
timer.h

index af47c6498a9be603b0e8e292c2cc4cfcf5520321..64fa49f2d0ce547465acbe0916882766dad888f4 100644 (file)
--- 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 52502a1f10eca8c23935491fc693acd9b7c5ecaf..9f00cd2be2e993f8b18e448244e37a17e3a089bb 100644 (file)
--- 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