summaryrefslogtreecommitdiffstats
path: root/ingen/Clock.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-01 14:28:50 +0200
committerDavid Robillard <d@drobilla.net>2020-08-02 01:48:48 +0200
commit6a1ce7d1ee5e6f20aa011fe994341d9d79ac35ea (patch)
treee541fcd73c05f2338840f1fcfa36dcb6a0d8895d /ingen/Clock.hpp
parent7fe8260c6c0a53fdc9ba04130c577122402a82ec (diff)
downloadingen-6a1ce7d1ee5e6f20aa011fe994341d9d79ac35ea.tar.gz
ingen-6a1ce7d1ee5e6f20aa011fe994341d9d79ac35ea.tar.bz2
ingen-6a1ce7d1ee5e6f20aa011fe994341d9d79ac35ea.zip
Make member functions const or static where possible
Diffstat (limited to 'ingen/Clock.hpp')
-rw-r--r--ingen/Clock.hpp12
1 files changed, 7 insertions, 5 deletions
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<uint64_t>(time.tv_sec) * 1e6 +
static_cast<uint64_t>(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
};