1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fix bela timestamping to use RT methods

This commit is contained in:
Cesare Ferrari 2019-07-23 17:12:32 +01:00 committed by Tom Poole
parent 8dd6c61125
commit a5c802c38f
2 changed files with 10 additions and 4 deletions

4
modules/juce_core/juce_core.cpp Normal file → Executable file
View file

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

10
modules/juce_core/native/juce_linux_SystemStats.cpp Normal file → Executable file
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