summaryrefslogtreecommitdiffstats
path: root/include/ingen/Clock.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/ingen/Clock.hpp')
-rw-r--r--include/ingen/Clock.hpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/ingen/Clock.hpp b/include/ingen/Clock.hpp
index deea0495..9e20a031 100644
--- a/include/ingen/Clock.hpp
+++ b/include/ingen/Clock.hpp
@@ -28,15 +28,16 @@
namespace ingen {
-class Clock {
+class Clock
+{
public:
#ifdef __MACH__
Clock() { mach_timebase_info(&_timebase); }
- inline uint64_t now_microseconds() const {
+ uint64_t now_microseconds() const {
const uint64_t now = mach_absolute_time();
- return now * _timebase.numer / _timebase.denom / 1e3;
+ return now * _timebase.numer / _timebase.denom / 1000U;
}
private:
@@ -44,11 +45,11 @@ private:
#else
- inline uint64_t now_microseconds() const {
+ uint64_t now_microseconds() const {
struct timespec time{};
clock_gettime(_clock, &time);
- return static_cast<uint64_t>(time.tv_sec) * 1e6 +
- static_cast<uint64_t>(time.tv_nsec) / 1e3;
+ return (static_cast<uint64_t>(time.tv_sec) * 1000000U) +
+ (static_cast<uint64_t>(time.tv_nsec) / 1000U);
}
private: