Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Unity-Technologies/bdwgc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Echterhoff <jonas@unity3d.com>2018-10-19 13:56:45 +0300
committerJonas Echterhoff <jonas@unity3d.com>2018-10-19 13:56:45 +0300
commit2fe2d43978aac6a1937864f7ec1962493600b014 (patch)
treef976fe835260065060a4a2e1d920e61ab41c85ea /include
parent7d654ec226e7baf14b8b780ba70689f1e46d9639 (diff)
better precision windows timers
Diffstat (limited to 'include')
-rw-r--r--include/private/gc_priv.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index 7661b279..0fec9147 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -444,14 +444,16 @@ EXTERN_C_END
# define NOSERVICE
# include <windows.h>
# include <winbase.h>
-# define CLOCK_TYPE DWORD
-# ifdef MSWINRT_FLAVOR
-# define GET_TIME(x) (void)(x = (DWORD)GetTickCount64())
-# else
-# define GET_TIME(x) (void)(x = GetTickCount())
-# endif
-# define MS_TIME_DIFF(a,b) ((long)((a)-(b)))
-# define NS_TIME_DIFF(a,b) ((long)((a)-(b)) * 1000000)
+# define CLOCK_TYPE LONGLONG
+# define GET_TIME(x) \
+ do { \
+ LARGE_INTEGER freq, t; \
+ QueryPerformanceFrequency(&freq); \
+ QueryPerformanceCounter(&t); \
+ x = t.QuadPart * 1000000000 / freq.QuadPart; \
+ } while (0)
+# define MS_TIME_DIFF(a,b) (((a) - (b)) * 1000000)
+# define NS_TIME_DIFF(a,b) ((a) - (b))
#elif defined(NN_PLATFORM_CTR)
# define CLOCK_TYPE long long
EXTERN_C_BEGIN