summaryrefslogtreecommitdiffstatshomepage
path: root/windows
diff options
context:
space:
mode:
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 1b2ed314ab..3ad6939059 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 a17f170214..854e14a7a8 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);