mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
Merged jeapostrophe patch for iOS 10
This commit is contained in:
parent
1ae0c8e2c4
commit
3603cafbba
@ -90,9 +90,8 @@
|
|||||||
#define CLOCK_REALTIME 0
|
#define CLOCK_REALTIME 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 100000
|
/* this function is part of iOS 10 now */
|
||||||
// this function is part of iOS 10 now
|
static int ra_clock_gettime(int clk_ik, struct timespec *t)
|
||||||
static int clock_gettime(int clk_ik, struct timespec *t)
|
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
int rv = gettimeofday(&now, NULL);
|
int rv = gettimeofday(&now, NULL);
|
||||||
@ -103,8 +102,13 @@ static int clock_gettime(int clk_ik, struct timespec *t)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MACH__) && __IPHONE_OS_VERSION_MAX_ALLOWED < 100000
|
||||||
|
#else
|
||||||
|
#define ra_clock_gettime clock_gettime
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
#include <emscripten.h>
|
#include <emscripten.h>
|
||||||
#endif
|
#endif
|
||||||
@ -141,8 +145,8 @@ retro_perf_tick_t cpu_features_get_perf_counter(void)
|
|||||||
tv_usec = (long)(system_time.wMilliseconds * 1000);
|
tv_usec = (long)(system_time.wMilliseconds * 1000);
|
||||||
time_ticks = (1000000 * tv_sec + tv_usec);
|
time_ticks = (1000000 * tv_sec + tv_usec);
|
||||||
#elif defined(__linux__) || defined(__QNX__) || defined(__MACH__)
|
#elif defined(__linux__) || defined(__QNX__) || defined(__MACH__)
|
||||||
struct timespec tv;
|
struct timespec tv = {0};
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &tv) == 0)
|
if (ra_clock_gettime(CLOCK_MONOTONIC, &tv) == 0)
|
||||||
time_ticks = (retro_perf_tick_t)tv.tv_sec * 1000000000 +
|
time_ticks = (retro_perf_tick_t)tv.tv_sec * 1000000000 +
|
||||||
(retro_perf_tick_t)tv.tv_nsec;
|
(retro_perf_tick_t)tv.tv_nsec;
|
||||||
|
|
||||||
@ -199,7 +203,7 @@ retro_time_t cpu_features_get_time_usec(void)
|
|||||||
return ticks_to_microsecs(gettime());
|
return ticks_to_microsecs(gettime());
|
||||||
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__)
|
#elif defined(_POSIX_MONOTONIC_CLOCK) || defined(__QNX__) || defined(ANDROID) || defined(__MACH__)
|
||||||
struct timespec tv = {0};
|
struct timespec tv = {0};
|
||||||
if (clock_gettime(CLOCK_MONOTONIC, &tv) < 0)
|
if (ra_clock_gettime(CLOCK_MONOTONIC, &tv) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
return tv.tv_sec * INT64_C(1000000) + (tv.tv_nsec + 500) / 1000;
|
return tv.tv_sec * INT64_C(1000000) + (tv.tv_nsec + 500) / 1000;
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user