From a5c802c38f802aa82ba1b3d81a227b25805fda14 Mon Sep 17 00:00:00 2001 From: Cesare Ferrari Date: Tue, 23 Jul 2019 17:12:32 +0100 Subject: [PATCH] Fix bela timestamping to use RT methods --- modules/juce_core/juce_core.cpp | 4 ++++ modules/juce_core/native/juce_linux_SystemStats.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) mode change 100644 => 100755 modules/juce_core/juce_core.cpp mode change 100644 => 100755 modules/juce_core/native/juce_linux_SystemStats.cpp diff --git a/modules/juce_core/juce_core.cpp b/modules/juce_core/juce_core.cpp old mode 100644 new mode 100755 index 79fa34f61a..890cd3680e --- a/modules/juce_core/juce_core.cpp +++ b/modules/juce_core/juce_core.cpp @@ -110,6 +110,10 @@ #include #endif +#if JUCE_BELA + #include +#endif + #undef check //============================================================================== diff --git a/modules/juce_core/native/juce_linux_SystemStats.cpp b/modules/juce_core/native/juce_linux_SystemStats.cpp old mode 100644 new mode 100755 index 9346225601..8b687d8f69 --- a/modules/juce_core/native/juce_linux_SystemStats.cpp +++ b/modules/juce_core/native/juce_linux_SystemStats.cpp @@ -20,6 +20,7 @@ ============================================================================== */ + namespace juce { @@ -175,18 +176,19 @@ void CPUInformation::initialise() noexcept //============================================================================== uint32 juce_millisecondsSinceStartup() noexcept { - timespec t; - clock_gettime (CLOCK_MONOTONIC, &t); - - return (uint32) (t.tv_sec * 1000 + t.tv_nsec / 1000000); + return uint32 (Time::getHighResolutionTicks() / 1000); } int64 Time::getHighResolutionTicks() noexcept { +#if JUCE_BELA + return rt_timer_read() / 1000; +#else timespec t; clock_gettime (CLOCK_MONOTONIC, &t); return (t.tv_sec * (int64) 1000000) + (t.tv_nsec / 1000); +#endif } int64 Time::getHighResolutionTicksPerSecond() noexcept