Browse Source

Fix bela timestamping to use RT methods

tags/2021-05-28
Cesare Ferrari Tom Poole 6 years ago
parent
commit
a5c802c38f
2 changed files with 10 additions and 4 deletions
  1. +4
    -0
      modules/juce_core/juce_core.cpp
  2. +6
    -4
      modules/juce_core/native/juce_linux_SystemStats.cpp

+ 4
- 0
modules/juce_core/juce_core.cpp View File

@@ -110,6 +110,10 @@
#include <android/log.h>
#endif
#if JUCE_BELA
#include <native/timer.h>
#endif
#undef check
//==============================================================================


+ 6
- 4
modules/juce_core/native/juce_linux_SystemStats.cpp View File

@@ -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


Loading…
Cancel
Save