aboutsummaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
authorstijn2016-11-01 10:25:13 +0100
committerstijn2016-11-03 10:31:58 +0100
commit3272afe57f3303ee178c6d0a3d08614a2a154e4e (patch)
treeb97589f69878e077f1b297448c56627c747869fe /windows
parent0b9ed550267ca0efba094d14c250f268d744818d (diff)
windows: Implement mp_hal_ticks_cpu in terms of QueryPerformanceCounter
Diffstat (limited to 'windows')
-rw-r--r--windows/windows_mphal.c10
-rw-r--r--windows/windows_mphal.h4
2 files changed, 12 insertions, 2 deletions
diff --git a/windows/windows_mphal.c b/windows/windows_mphal.c
index 1b2ed314a..3ad693905 100644
--- a/windows/windows_mphal.c
+++ b/windows/windows_mphal.c
@@ -217,3 +217,13 @@ mp_uint_t mp_hal_ticks_us(void) {
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000000 + tv.tv_usec;
}
+
+mp_uint_t mp_hal_ticks_cpu(void) {
+ LARGE_INTEGER value;
+ QueryPerformanceCounter(&value);
+#ifdef _WIN64
+ return value.QuadPart;
+#else
+ return value.LowPart;
+#endif
+}
diff --git a/windows/windows_mphal.h b/windows/windows_mphal.h
index a17f17021..854e14a7a 100644
--- a/windows/windows_mphal.h
+++ b/windows/windows_mphal.h
@@ -32,5 +32,5 @@
void mp_hal_move_cursor_back(unsigned int pos);
void mp_hal_erase_line_from_cursor(unsigned int n_chars_to_erase);
-// TODO: Implement.
-#define mp_hal_ticks_cpu() 0
+#undef mp_hal_ticks_cpu
+mp_uint_t mp_hal_ticks_cpu(void);