summaryrefslogtreecommitdiff
path: root/qstd/plat.c
diff options
context:
space:
mode:
Diffstat (limited to 'qstd/plat.c')
-rw-r--r--qstd/plat.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/qstd/plat.c b/qstd/plat.c
index 15e0265..b34e8cb 100644
--- a/qstd/plat.c
+++ b/qstd/plat.c
@@ -186,5 +186,22 @@ void pbreak(int code) {
#endif
}
+uint64_t timer_freq;
+int timer_init = 0;
+
+void init_timer(void) {
+ LARGE_INTEGER f;
+ QueryPerformanceFrequency(&f);
+ timer_freq = (uint64_t)f.QuadPart;
+ timer_init = 1;
+}
+
+uint64_t get_time(void) {
+ if (!timer_init)
+ init_timer();
+ LARGE_INTEGER ticks;
+ QueryPerformanceCounter(&ticks);
+ return (uint64_t)ticks.QuadPart * 1000000000 / timer_freq;
+}
#endif