From e3498cf0825e1ca9f5cbad0cee4cdb090964baf2 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Thu, 2 Feb 2017 10:23:59 +0000 Subject: Posix simulator, still work in progress. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10077 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/common/ports/SIMIA32/chcore.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'os/common/ports') diff --git a/os/common/ports/SIMIA32/chcore.c b/os/common/ports/SIMIA32/chcore.c index 73e91fa0a..83a1574a9 100644 --- a/os/common/ports/SIMIA32/chcore.c +++ b/os/common/ports/SIMIA32/chcore.c @@ -25,7 +25,11 @@ * @{ */ +#if defined(WIN32) #include +#else +#include +#endif #include "ch.h" @@ -110,11 +114,18 @@ void _port_thread_start(msg_t (*pf)(void *), void *p) { * @return The realtime counter value. */ rtcnt_t port_rt_get_counter_value(void) { +#if defined(WIN32) LARGE_INTEGER n; QueryPerformanceCounter(&n); return (rtcnt_t)(n.QuadPart / 1000LL); +#else + struct timeval tv; + + gettimeofday(&tv, NULL); + return ((rtcnt_t)tv.tv_sec * (rtcnt_t)1000000) + (rtcnt_t)tv.tv_usec; +#endif } /** @} */ -- cgit v1.2.3