diff options
author | timcannell <timcannell@unity3d.com> | 2020-05-15 00:42:42 +0300 |
---|---|---|
committer | timcannell <timcannell@unity3d.com> | 2020-05-15 00:42:42 +0300 |
commit | 297496b021f433ce3bc5264eda3c5ddc6ecce69a (patch) | |
tree | 1df2de3bff6e00b263c930d7923586a904ca23b4 | |
parent | 366aaf6534e19778492c91aa5c3f4c6e5e1fa59e (diff) | |
parent | 49e0fa85e4b5ba0bb4b37e14c64e19ca20bd3789 (diff) |
Merge branch 'unity-master' into fix-nda-platforms
-rw-r--r-- | include/private/gc_priv.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index aaf67d7f..9945f1a4 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -463,7 +463,21 @@ EXTERN_C_END # define GET_TIME(x) (void)(x = n3ds_get_system_tick()) # define MS_TIME_DIFF(a,b) ((long)n3ds_convert_tick_to_ms((a)-(b))) # define NS_TIME_DIFF(a,b) ((long long)n3ds_convert_tick_to_ms((a)-(b)) * 1000000) -#else /* !BSD_TIME && !NN_PLATFORM_CTR && !MSWIN32 && !MSWINCE */ +#elif defined(NINTENDO_SWITCH) +#include <time.h> +# define CLOCK_TYPE long long +# define GET_TIME(x) \ + do { \ + struct timespec t;\ + int r = clock_gettime(CLOCK_REALTIME, &t);\ + x=-1;\ + if (r != -1) {\ + x = (t.tv_sec * 1000000000) + t.tv_nsec;\ + }\ + } while (0) +# define MS_TIME_DIFF(a,b) ((unsigned long)(((a) - (b)) / 1000000)) +# define NS_TIME_DIFF(a,b) ((a)-(b)) +#else /* !BSD_TIME && !NN_PLATFORM_CTR && !MSWIN32 && !MSWINCE && !NINTENDO_SWITCH */ # include <time.h> # if defined(FREEBSD) && !defined(CLOCKS_PER_SEC) # include <machine/limits.h> |