Commit eb95f6fa authored by David Reid's avatar David Reid

Merge branch 'dev' into decoder

parents 631ab4d6 12f0b635
...@@ -1644,6 +1644,10 @@ mal_result mal_decoder_seek_to_frame(mal_decoder* pDecoder, mal_uint64 frameInde ...@@ -1644,6 +1644,10 @@ mal_result mal_decoder_seek_to_frame(mal_decoder* pDecoder, mal_uint64 frameInde
#include <string.h> // For memset() #include <string.h> // For memset()
#endif #endif
#if defined(MAL_APPLE) && (__MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
#include <mach/mach_time.h> // For mach_absolute_time()
#endif
#ifdef MAL_POSIX #ifdef MAL_POSIX
#include <unistd.h> #include <unistd.h>
#include <dlfcn.h> #include <dlfcn.h>
...@@ -2170,6 +2174,24 @@ double mal_timer_get_time_in_seconds(mal_timer* pTimer) ...@@ -2170,6 +2174,24 @@ double mal_timer_get_time_in_seconds(mal_timer* pTimer)
return (counter.QuadPart - pTimer->counter) / (double)g_mal_TimerFrequency.QuadPart; return (counter.QuadPart - pTimer->counter) / (double)g_mal_TimerFrequency.QuadPart;
} }
#elif defined(MAL_APPLE) && (__MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
static uint64_t g_mal_TimerFrequency = 0;
void mal_timer_init(mal_timer* pTimer)
{
mach_timebase_info_data_t baseTime;
mach_timebase_info(&baseTime);
g_mal_TimerFrequency = (baseTime.denom * 1e9) / baseTime.numer;
pTimer->counter = mach_absolute_time();
}
double mal_timer_get_time_in_seconds(mal_timer* pTimer)
{
uint64_t newTimeCounter = mach_absolute_time();
uint64_t oldTimeCounter = pTimer->counter;
return (newTimeCounter - oldTimeCounter) / g_mal_TimerFrequency;
}
#else #else
void mal_timer_init(mal_timer* pTimer) void mal_timer_init(mal_timer* pTimer)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment