From 6a1ce7d1ee5e6f20aa011fe994341d9d79ac35ea Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 1 Aug 2020 14:28:50 +0200 Subject: Make member functions const or static where possible --- ingen/Clock.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ingen/Clock.hpp') diff --git a/ingen/Clock.hpp b/ingen/Clock.hpp index c3b0f64d..5345d7a6 100644 --- a/ingen/Clock.hpp +++ b/ingen/Clock.hpp @@ -47,15 +47,17 @@ private: inline uint64_t now_microseconds() const { struct timespec time; -# if defined(CLOCK_MONOTONIC_RAW) - clock_gettime(CLOCK_MONOTONIC_RAW, &time); -# else - clock_gettime(CLOCK_MONOTONIC, &time); -# endif + clock_gettime(_clock, &time); return static_cast(time.tv_sec) * 1e6 + static_cast(time.tv_nsec) / 1e3; } +private: +# if defined(CLOCK_MONOTONIC_RAW) + const clockid_t _clock = CLOCK_MONOTONIC_RAW; +# else + const clockid_t _clock = CLOCK_MONOTONIC; +# endif #endif }; -- cgit v1.2.1